NYCPHP Meetup

NYPHP.org

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

Hans Zaunere lists at zaunere.com
Sat Mar 8 19:37:41 EST 2008


> Is there any preference for:
> 
> $val = isset($arr['key']) ? $arr['key'] : null;

This is preferred - it's actually doing something correct.

> vs:
> 
> $val = @$arr['key'];

This is a hack, which causes an error, which you're then suppressing

Marcus and I discussed a shortcut for the first example at the last Montreal
PHP Conference, but I don't think it's been implemented yet.

H





More information about the talk mailing list