Andrei Zmievski wrote:
On Tue, 13 Jan 2004, Andrey Hristov wrote:
Hi, just a correction, I meant array_diff when i wrote array_intersect. array_diff is more handy since just count($res)==0 is enough, $res is the returned array of array_diff().
Did you actually try array_intersect()?
- Andrei
Here it is : [EMAIL PROTECTED]:~/dev/5_0> cat s2.php <?php $i = 0; while ($i++ < 1000) { $a[] = $i; } $start = microtime(1); $res = in_array_all(100, 2, 3, $a, true); $end = microtime(1); var_dump($res); printf("Time : %3.5f\n",$end - $start); $needles = array(100, 2, 3); $start = microtime(1); $diff = array_intersect($needles, $a); $end = microtime(1); var_dump($diff); printf("Time : %3.5f\n",$end - $start);
?>[EMAIL PROTECTED]:~/dev/5_0> ./php s2.php bool(true) Time : 0.00010 array(3) { [0]=> int(100) [1]=> int(2) [2]=> int(3) } Time : 0.03078
About 300x .
Andrey
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php