On 10/25/2010 1:12 PM, Rob Marscher wrote:
On Oct 25, 2010, at 1:03 PM, Paul A Houle wrote:
On 10/25/2010 12:22 PM, David Mintz wrote:
Anybody know of any reason not to save a little typing with
empty($array['foo'])
I think also this will throw an error or exception if you're running with 
E_STRICT,  which you should.
I thought so too, but I tested it this morning and it didn't seem to throw a 
notice.  It must operate like isset.

    Well if you think array_key_exists($key,$array) is wack,  you can write

function has_key($array,$key) {
    return array_key_exists($key,$array);
}

personally I hate the reversal of order in array_key_exists as compared to $array[$key]. The only trouble is that this one more thing for the guy who maintains your code in the future to remember.
_______________________________________________
New York PHP Users Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/Show-Participation

Reply via email to