3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( "1" => array("fruit","salad","vegetable"), "2" => array("beef","meat","sausage"), "3" => array("chocolate","cake","bread"), "4" => array("sausage","cake","bread"), ); $expl = explode(' ', "I love big sausage"); $array = array_filter($array, function($x) use ($expl) { return count(array_intersect($expl, $x)) > 0; }); var_dump(array_keys($array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q54fA
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array, !1 = $expl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAL                                                 'I+love+big+sausage'
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
   11     6        INIT_FCALL                                               'array_filter'
          7        SEND_VAR                                                 !0
          8        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          9        BIND_LEXICAL                                             ~5, !1
   13    10        SEND_VAL                                                 ~5
   11    11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !0, $6
   14    13        INIT_FCALL                                               'var_dump'
         14        INIT_FCALL                                               'array_keys'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                                 
         19      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q54fA
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $x, !1 = $expl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   12     2        INIT_FCALL                                               'array_intersect'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        COUNT                                            ~3      $2
          7        IS_SMALLER                                       ~4      0, ~3
          8      > RETURN                                                   ~4
   13     9*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.78 ms | 1005 KiB | 18 Q