3v4l.org

run code in 300+ PHP versions simultaneously
<?php function coolPluck($array, $allowed) { $output = array(); foreach($array as $k => $v) { if(is_array($v)) { $results = coolPluck($v, $lookup); $output[] = array_intersect_key($results[$k], array_flip($allowed)); } } return $output; } $testArray = array('test' => array('percy' => array('percy' => 'hatcherson'), 'percy' => array('mitchell', 'anderson'))); var_dump(coolPluck($testArray, array('percy')));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kbipR
function name:  (null)
number of ops:  9
compiled vars:  !0 = $testArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, <array>
   22     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'coolpluck'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <array>
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function coolpluck:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 24
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 23
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 23
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/kbipR
function name:  coolPluck
number of ops:  27
compiled vars:  !0 = $array, !1 = $allowed, !2 = $output, !3 = $v, !4 = $k, !5 = $results, !6 = $lookup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ASSIGN                                                   !2, <array>
    7     3      > FE_RESET_R                                       $8      !0, ->24
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->24
          5    >   ASSIGN                                                   !4, ~9
    9     6        TYPE_CHECK                                  128          !3
          7      > JMPZ                                                     ~11, ->23
   10     8    >   INIT_FCALL_BY_NAME                                       'coolPluck'
          9        SEND_VAR_EX                                              !3
         10        SEND_VAR_EX                                              !6
         11        DO_FCALL                                      0  $12     
         12        ASSIGN                                                   !5, $12
   11    13        INIT_FCALL                                               'array_intersect_key'
         14        FETCH_DIM_R                                      ~15     !5, !4
         15        SEND_VAL                                                 ~15
         16        INIT_FCALL                                               'array_flip'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $16     
         19        SEND_VAR                                                 $16
         20        DO_ICALL                                         $17     
         21        ASSIGN_DIM                                               !2
         22        OP_DATA                                                  $17
    7    23    > > JMP                                                      ->4
         24    >   FE_FREE                                                  $8
   15    25      > RETURN                                                   !2
   16    26*     > RETURN                                                   null

End of function coolpluck

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.13 ms | 1394 KiB | 20 Q