Is there a quick (er) way to check if an array exists matching the pattern? My goal is to use the value of the key starting with " song_ ", no matter how it ends.
I am currently doing this:
foreach($result as $r){ // $r = array("title"=>'abc', "song_5" => 'abc') $keys = array_keys($r); foreach($keys as $key){ if (preg_match("/^song_/", $key) { echo "FOUND {$r[$key]}"; } } }
Is there a way for preg_match for arrays or foreach via array_keys most native way to do this?
string arrays php regex
d -_- b
source share