PHP has a function strpos() for finding the position of the first instance of a given value in a string. Is there a way to do this with a needle that is an array of strings? It would give the first occurence:
$str = '1st and 3rd';
str_array_pos($str, array('st', 'nd', 'rd', 'th')) //would return 1 because of 'st'
foreachover the needle array, do thestrpos()and save the results in an array. You're looking for themin()of all the results.