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

Hans Zaunere lists at
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.


More information about the talk mailing list