3v4l.org

run code in 300+ PHP versions simultaneously
<?php function searchNested($arr,$keyword){ $found = array(); foreach($arr as $item){ if($item['categorySlug']==$keyword){ $found[] = $item; }else{ $found = array_merge($found,__FUNC__($array,$keyword)); } } return $found; } var_dump(searchNested(array(array ( 'categoryName' => 'Moto', 'categoryTitle' => 'Moto', 'categorySlug' => 'moto-and-tech', 'categoryAttr' => array ( 0 => 'test1', 1 => 'test2', 2 => 'test3', 3 => 'test4' ), 'categoryNested' => array ( 0 => array ( 'categoryName' => 'anything', 'categoryTitle' => 'anything', 'categorySlug' => 'anything', 'categoryAttr' => array ( 0 => 'test1', 1 => 'test1', 2 => 'test1', 3 => 'test1' ), 'categoryNested' => array() ), 1 => array ( 'categoryName' => 'any', 'categoryTitle' => 'any', 'categorySlug' => 'any', 'categoryAttr' => array ( 0 => 'test1', 1 => 'test1', 2 => 'test1', 3 => 'test1' ), 'categoryNested' => array() ))))));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QrjHZ
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'searchnested'
   16     2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   55     6      > RETURN                                                   1

Function searchnested:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 21
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/QrjHZ
function name:  searchNested
number of ops:  24
compiled vars:  !0 = $arr, !1 = $keyword, !2 = $found, !3 = $item, !4 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        ASSIGN                                                   !2, <array>
    4     3      > FE_RESET_R                                       $6      !0, ->21
          4    > > FE_FETCH_R                                               $6, !3, ->21
    5     5    >   FETCH_DIM_R                                      ~7      !3, 'categorySlug'
          6        IS_EQUAL                                                 !1, ~7
          7      > JMPZ                                                     ~8, ->11
    6     8    >   ASSIGN_DIM                                               !2
          9        OP_DATA                                                  !3
         10      > JMP                                                      ->20
    8    11    >   INIT_FCALL                                               'array_merge'
         12        SEND_VAR                                                 !2
         13        INIT_FCALL_BY_NAME                                       '__FUNC__'
         14        SEND_VAR_EX                                              !4
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0  $10     
         17        SEND_VAR                                                 $10
         18        DO_ICALL                                         $11     
         19        ASSIGN                                                   !2, $11
    4    20    > > JMP                                                      ->4
         21    >   FE_FREE                                                  $6
   11    22      > RETURN                                                   !2
   12    23*     > RETURN                                                   null

End of function searchnested

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.92 ms | 1399 KiB | 18 Q