NYCPHP Meetup

NYPHP.org

[nycphp-talk] Is @$arr['key'] ok?

csnyder chsnyder at gmail.com
Mon Mar 10 10:33:20 EDT 2008


On Mon, Mar 10, 2008 at 9:28 AM, Kenneth Downs <ken at secdat.com> wrote:
>
>  function arraySafe($array,$key,$default='') {
>   if(isset($array[$key]))
>      return $array[$key];
>   else
>      return $default;
>  }
>

Yes, very useful pattern. Handy for grabbing input out of $_GET and
$_POST arrays.


-- 
Chris Snyder
http://chxo.com/



More information about the talk mailing list