Hi, isset($array[$key]) is around 160% faster than array_key_exists($key, $array).
That's one of the changes we've benchmarked in Doctrine 1 that we integrated into Doctrine 1.2. Of course there're some situations that you cannot trust isset() and you should still keep with array_key_exists. Cheers, On Mon, Oct 25, 2010 at 3:32 PM, Paul A Houle <p...@devonianfarm.com> wrote: > 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 > -- Guilherme Blanco Mobile: +55 (16) 9215-8480 MSN: guilhermebla...@hotmail.com São Paulo - SP/Brazil _______________________________________________ New York PHP Users Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/Show-Participation