On 06/07/2011 04:35 PM, Alex Nikitin wrote: > Shawn, == is not good for string comparison, its a bad habit that one > should get out of, use ===, its much safer . Yes, except that I was comparing a string to an array of integers :) > > Also try the same algorithm on 100000 arrays of some number of values > 10-1000 perhaps, that would give you better performance statistics :) > LOOP WITH PREG MATCH: 650.627260 seconds PREG_GREP: 123.110386 seconds This was with 100,000 arrays each with 1,000 values. Of course the loop iterates through the entire loop which is needed to find all matches. If only one match is needed then you can just break out of the loop to save time. If we assume that half of the matches will be in the lower 500 and half in the upper then we can half the time for the loop but it is still 325 seconds. Thanks! -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php