I have an array and I\'d like to search for the string \'green\'. So in this case it should return the $arr[2]
\'green\'
$arr[2]
$arr = array(0 =>
PHP 5.3+
array_walk($arr, function($item, $key) { if(strpos($item, 'green') !== false) { echo 'Found in: ' . $item . ', with key: ' . $key; } });