3v4l.org

run code in 300+ PHP versions simultaneously
<?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));

preferences:
47.79 ms | 402 KiB | 5 Q