NYCPHP Meetup

NYPHP.org

[nycphp-talk] More type casting help

Cliff Hirsch cliff at pinestream.com
Mon Jul 2 15:07:43 EDT 2007


in_array($value, $options, true) solves issues with type conversion (like
Œfoobar¹ == (int)0)

But what about the equivalent for a key search?

array_key_exists ( mixed key, array search ) performs automatic type
conversion ‹ evil.

I came up with:  count(array_keys($options, $value, true)) === 0

Any other ideas?

Cliff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070702/ddf420a0/attachment.html>


More information about the talk mailing list