3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ ['foo' => 'bar'], ['foo' => 'bit'], ['foo' => 'biz'], ['foo' => 'but'], ['foo' => 'baz'], ]; $arr2 = ['bit','but','bat']; $arr3 = array_filter($arr1, function ($v) use ($arr2) { return array_search($v['foo'],$arr2) !== false; }); print_r($arr3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kHTKB
function name:  (null)
number of ops:  13
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $arr3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   12     2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FkHTKB%3A12%240'
          5        BIND_LEXICAL                                             ~5, !1
   14     6        SEND_VAL                                                 ~5
          7        DO_ICALL                                         $6      
   12     8        ASSIGN                                                   !2, $6
   16     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FkHTKB%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kHTKB
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $v, !1 = $arr2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   13     2        INIT_FCALL                                               'array_search'
          3        FETCH_DIM_R                                      ~2      !0, 'foo'
          4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7        TYPE_CHECK                                  1018  ~4      $3
          8      > RETURN                                                   ~4
   14     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FkHTKB%3A12%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.37 ms | 1395 KiB | 19 Q