3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 1, 2, [ [ 'one' => '1', 'two' => 2 ] ] ]; function array_search_recursive_pair(array $array, $key, $value, $strict = false) { if (isset($array[$key]) && (($strict && $array[$key] === $value) || (!$strict && $array[$key] == $value))) { return $array; } foreach ($array as $el) { if (is_array($el) && $result = array_search_recursive_pair($el, $key, $value, $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/YgtGi
function name:  (null)
number of ops:  19
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                                                 'one'
          5        SEND_VAL                                                 1
          6        DO_FCALL                                      0  $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                                 
   30     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'array_search_recursive_pair'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 'one'
         13        SEND_VAL                                                 1
         14        SEND_VAL                                                 <true>
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

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

End of function array_search_recursive_pair

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.01 ms | 1394 KiB | 17 Q