3v4l.org

run code in 300+ PHP versions simultaneously
<?php function filterKeys($array,$search){ $allowed=array_filter(array_keys($array),function($key) use ($search){return stristr($key,$search);}); return array_intersect_key($array,array_flip($allowed)); } var_dump(filterKeys(array('foo'=>'bar', 'moo'=>'baz'),'foo')); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RoKlG
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'filterkeys'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 'foo'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
    8     7      > RETURN                                                   1

Function filterkeys:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RoKlG
function name:  filterKeys
number of ops:  21
compiled vars:  !0 = $array, !1 = $search, !2 = $allowed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'array_filter'
          3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FRoKlG%3A3%240'
          8        BIND_LEXICAL                                             ~4, !1
          9        SEND_VAL                                                 ~4
         10        DO_ICALL                                         $5      
         11        ASSIGN                                                   !2, $5
    4    12        INIT_FCALL                                               'array_intersect_key'
         13        SEND_VAR                                                 !0
         14        INIT_FCALL                                               'array_flip'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $7      
         17        SEND_VAR                                                 $7
         18        DO_ICALL                                         $8      
         19      > RETURN                                                   $8
    5    20*     > RETURN                                                   null

End of function filterkeys

Function %00%7Bclosure%7D%2Fin%2FRoKlG%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RoKlG
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $key, !1 = $search
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        INIT_FCALL                                               'stristr'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
          7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FRoKlG%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.38 ms | 1403 KiB | 26 Q