3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function recursive_array_search($needle,$haystack) { foreach($haystack as $key=>$value) { $current_key=$key; if($needle===$value OR (is_array($value) && recursive_array_search($needle,$value) !== false)) { return $current_key; } } return false; } $arr = [ 31 => "Pelican", 29 => [ "FErQa" => [ "user_file_name" => "Pelican.jpg", "file_name" => "pelican-006.jpg", "file_path" => "/nas/content/live/mysite/wp-content/uploads/sites/2/ninja-forms/", "file_url" => "http://mysite/wp-content/uploads/sites/ ... an-006.jpg", "complete" => "1", "upload_id" => "19", ] ] ]; var_dump(recursive_array_search("/nas/content/live/mysite/wp-content/uploads/sites/2/ninja-forms/", $arr));
Output for 5.4.10 - 7.2.0
int(29)
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/nMMf6 on line 13
Process exited with code 255.