3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 1, 2, [ [ 'one' => '1', 'two' => 2 ] ] ]; function array_search_recursive_pair(array $array, array $pair, $strict = false) { if (isset($array[$key]) && (($strict && $array[key($pair)] === current($pair)) || (!$strict && $array == $pair))) { return $array; } foreach ($array as $el) { if (is_array($el) && $result = array_search_recursive_pair($el, $pair, $strict)) { return $result; } } return false; } var_dump(array_search_recursive_pair($arr, ['one' => '1'])); var_dump(array_search_recursive_pair($arr, ['one' => 1], true));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jV8Wl
function name:  (null)
number of ops:  17
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   29     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'array_search_recursive_pair'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <array>
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
   30     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'array_search_recursive_pair'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 <array>
         12        SEND_VAL                                                 <true>
         13        DO_FCALL                                      0  $4      
         14        SEND_VAR                                                 $4
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function array_search_recursive_pair:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 22
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
2 jumps found. (Code = 47) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 39
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 39
Branch analysis from position: 26
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 35
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 38
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 35
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
Branch analysis from position: 20
Branch analysis from position: 21
Branch analysis from position: 15
Branch analysis from position: 22
filename:       /in/jV8Wl
function name:  array_search_recursive_pair
number of ops:  42
compiled vars:  !0 = $array, !1 = $pair, !2 = $strict, !3 = $key, !4 = $el, !5 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <false>
   16     3        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !0, !3
          4      > JMPZ_EX                                          ~6      ~6, ->22
          5    > > JMPZ_EX                                          ~7      !2, ->15
          6    >   INIT_FCALL                                               'key'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $8      
          9        FETCH_DIM_R                                      ~9      !0, $8
         10        INIT_FCALL                                               'current'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $10     
         13        IS_IDENTICAL                                     ~11     $10, ~9
         14        BOOL                                             ~7      ~11
         15    > > JMPNZ_EX                                         ~7      ~7, ->21
         16    >   BOOL_NOT                                         ~12     !2
         17      > JMPZ_EX                                          ~12     ~12, ->20
         18    >   IS_EQUAL                                         ~13     !0, !1
         19        BOOL                                             ~12     ~13
         20    >   BOOL                                             ~7      ~12
         21    >   BOOL                                             ~6      ~7
         22    > > JMPZ                                                     ~6, ->24
   17    23    > > RETURN                                                   !0
   20    24    > > FE_RESET_R                                       $14     !0, ->39
         25    > > FE_FETCH_R                                               $14, !4, ->39
   21    26    >   TYPE_CHECK                                  128  ~15     !4
         27      > JMPZ_EX                                          ~15     ~15, ->35
         28    >   INIT_FCALL_BY_NAME                                       'array_search_recursive_pair'
         29        SEND_VAR_EX                                              !4
         30        SEND_VAR_EX                                              !1
         31        SEND_VAR_EX                                              !2
         32        DO_FCALL                                      0  $16     
         33        ASSIGN                                           ~17     !5, $16
         34        BOOL                                             ~15     ~17
         35    > > JMPZ                                                     ~15, ->38
   22    36    >   FE_FREE                                                  $14
         37      > RETURN                                                   !5
   20    38    > > JMP                                                      ->25
         39    >   FE_FREE                                                  $14
   26    40      > RETURN                                                   <false>
   27    41*     > RETURN                                                   null

End of function array_search_recursive_pair

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.35 ms | 1403 KiB | 21 Q