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) { $key = key($pair); if (isset($array[$key]) && (($strict && $array[$key] === 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/CGVsB
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>
   30     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                                                 
   31     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 = 9, Position 2 = 23
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 40
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 40
Branch analysis from position: 27
2 jumps found. (Code = 46) Position 1 = 29, Position 2 = 36
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 36
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
Branch analysis from position: 21
Branch analysis from position: 22
Branch analysis from position: 16
Branch analysis from position: 23
filename:       /in/CGVsB
function name:  array_search_recursive_pair
number of ops:  43
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        INIT_FCALL                                               'key'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !3, $6
   17     7        ISSET_ISEMPTY_DIM_OBJ                         0  ~8      !0, !3
          8      > JMPZ_EX                                          ~8      ~8, ->23
          9    > > JMPZ_EX                                          ~9      !2, ->16
         10    >   FETCH_DIM_R                                      ~10     !0, !3
         11        INIT_FCALL                                               'current'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $11     
         14        IS_IDENTICAL                                     ~12     $11, ~10
         15        BOOL                                             ~9      ~12
         16    > > JMPNZ_EX                                         ~9      ~9, ->22
         17    >   BOOL_NOT                                         ~13     !2
         18      > JMPZ_EX                                          ~13     ~13, ->21
         19    >   IS_EQUAL                                         ~14     !0, !1
         20        BOOL                                             ~13     ~14
         21    >   BOOL                                             ~9      ~13
         22    >   BOOL                                             ~8      ~9
         23    > > JMPZ                                                     ~8, ->25
   18    24    > > RETURN                                                   !0
   21    25    > > FE_RESET_R                                       $15     !0, ->40
         26    > > FE_FETCH_R                                               $15, !4, ->40
   22    27    >   TYPE_CHECK                                  128  ~16     !4
         28      > JMPZ_EX                                          ~16     ~16, ->36
         29    >   INIT_FCALL_BY_NAME                                       'array_search_recursive_pair'
         30        SEND_VAR_EX                                              !4
         31        SEND_VAR_EX                                              !1
         32        SEND_VAR_EX                                              !2
         33        DO_FCALL                                      0  $17     
         34        ASSIGN                                           ~18     !5, $17
         35        BOOL                                             ~16     ~18
         36    > > JMPZ                                                     ~16, ->39
   23    37    >   FE_FREE                                                  $15
         38      > RETURN                                                   !5
   21    39    > > JMP                                                      ->26
         40    >   FE_FREE                                                  $15
   27    41      > RETURN                                                   <false>
   28    42*     > RETURN                                                   null

End of function array_search_recursive_pair

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.92 ms | 1403 KiB | 21 Q