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));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nMMf6
function name:  (null)
number of ops:  9
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   29     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'recursive_array_search'
          3        SEND_VAL                                                 '%2Fnas%2Fcontent%2Flive%2Fmysite%2Fwp-content%2Fuploads%2Fsites%2F2%2Fninja-forms%2F'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function recursive_array_search:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
Branch analysis from position: 17
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/nMMf6
function name:  recursive_array_search
number of ops:  24
compiled vars:  !0 = $needle, !1 = $haystack, !2 = $value, !3 = $key, !4 = $current_key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2      > FE_RESET_R                                       $5      !1, ->21
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->21
          4    >   ASSIGN                                                   !3, ~6
    5     5        ASSIGN                                                   !4, !3
    6     6        IS_IDENTICAL                                     ~9      !0, !2
          7      > JMPNZ_EX                                         ~9      ~9, ->17
          8    >   TYPE_CHECK                                  128  ~10     !2
          9      > JMPZ_EX                                          ~10     ~10, ->16
         10    >   INIT_FCALL_BY_NAME                                       'recursive_array_search'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !2
         13        DO_FCALL                                      0  $11     
         14        TYPE_CHECK                                  1018  ~12     $11
         15        BOOL                                             ~10     ~12
         16    >   BOOL                                             ~9      ~10
         17    > > JMPZ                                                     ~9, ->20
    7    18    >   FE_FREE                                                  $5
         19      > RETURN                                                   !4
    4    20    > > JMP                                                      ->3
         21    >   FE_FREE                                                  $5
   10    22      > RETURN                                                   <false>
   11    23*     > RETURN                                                   null

End of function recursive_array_search

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.55 ms | 1403 KiB | 16 Q