Can you search an array via a regular expression? I tried the following but couldn’t get it to return anything. It should return the key of the matching array value:
$array = array(“homer”, “j”, “simpson”);
echo $array[array_search(’.’, $array)]; //return initial
It’s possible my syntax for the reg ex is wrong, but I read somewhere that ‘.’ will look for a single character of any type.
Thanks in advance.