Your xxxxxx will be array_map . But alas, you cannot use strpos as a regular callback here. To pass the actual search parameter, you need to define a user-defined or anonymous function -
And to get what you want, you need to wrap even more:
$key = key( array_filter( array_map( function($s){return strpos($s, "gr");}, $array ), "is_int") );
This gives you an index 2 search.
mario source share