I am trying to find a function which can find the index in an array, when I know just part of the string.
The function array_search returns me the index only in case I know whole string.
How do I get the index/key when I only have a substring of the array items?
$array = array(0 => 'blue pants', 1 => 'red pants', 2 => 'green pants', 3 => 'green pants');
echo array_search('red', $array);
I need to echo 1.