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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to