There have been questions asking which is faster strpos or preg_match, but I'm interested which in knowing which uses the least memory and CPU resources.
I want to check a line for one of 5 matches:
if (strpos($key, 'matchA') !== false || strpos($key, 'matchB') !== false || strpos($key, 'matchC') !== false || strpos($key, 'matchD') !== false || strpos($key, 'matchE') !== false)
if (preg_match("~(matchA|matchB|matchC|matchD|matchE)~i",$key, $match))
What is the best way to do this using the least strain on the server..
Thanks