Re: Re: new function?

From: Date: Wed, 14 Jan 2004 00:00:48 +0000
Subject: Re: Re: new function?
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-7082@lists.php.net to get a copy of this message
Andrey Hristov wrote:
Hi, jason davidson wrote:
I like the idea of passing an array of needles, I wonder if you could just add the ability to pass a needles array to in_array, rather than create a new function. Anyways, it adds flexability, I would use it. Jason
Unfortunately, in_array() cannot be modified since this will break BC. Consider this example : php -r '$a = array(1, 2); $haystack = array("string", array(1, 2), 5.5); var_dump(in_array($a, $haystack));' So, in_array() checks for everything, including arrays, starting PHP5 it can look for objects too. So the BC is that till now an array as first parameter is quite ok therefore it cannot be changed. Andrey
Sorry, i hadnt even realized that you could already pass needles array into in_array, and now i beleive ive missed the whole point of this thread.. Im done.. :) J

« previous php.internals (#7082) next »