NYCPHP Meetup

NYPHP.org

[nycphp-talk] More type casting help

Cliff Hirsch cliff at pinestream.com
Mon Jul 2 15:11:34 EDT 2007


Ignore my solution ‹ hasty and wrong.

On 7/2/07 3:07 PM, "Cliff Hirsch" <cliff at pinestream.com> wrote:

> 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/a8fbcefe/attachment.html>


More information about the talk mailing list