3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array("test"=>"1", "test2"=>2, "test3"=>3); $needed = array("test", "test2"); $a = array_filter(array($a, $needed), function ($item, $needed) { return in_array($item, $needed); });
based on FnVQX
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GutRe
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a, !1 = $needed
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   ASSIGN                                                   !0, <array>
   4     1        ASSIGN                                                   !1, <array>
   6     2        INIT_FCALL                                               'array_filter'
         3        INIT_ARRAY                                       ~4      !0
         4        ADD_ARRAY_ELEMENT                                ~4      !1
         5        SEND_VAL                                                 ~4
         6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FGutRe0x7f70062960c3'
   8     7        SEND_VAL                                                 ~5
         8        DO_ICALL                                         $6      
         9        ASSIGN                                                   !0, $6
        10      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FGutRe0x7f70062960c3

Generated using Vulcan Logic Dumper, using php 7.3.0