3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cars = [ 0 => ["id" => 1, "name" => "FORD"], 1 => ["id" => 2, "name" => "BMW"], 2 => ["id" => 3, "name" => "FIAT"], 3 => ["id" => 4, "name" => "RENAULT"], 4 => ["id" => 5, "name" => "BENTLEY"], ]; $selection = [ 0 => "1", 1 => "3", 2 => "4" ]; $carsBySelection = array_filter($cars, function($car) use ($selection) { return in_array($car["id"], $selection); }); print_r($carsBySelection);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cHa1R
function name:  (null)
number of ops:  13
compiled vars:  !0 = $cars, !1 = $selection, !2 = $carsBySelection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   17     2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          5        BIND_LEXICAL                                             ~5, !1
   19     6        SEND_VAL                                                 ~5
   17     7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !2, $6
   21     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
         12      > 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/cHa1R
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $car, !1 = $selection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   18     2        INIT_FCALL                                               'in_array'
          3        FETCH_DIM_R                                      ~2      !0, 'id'
          4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   19     8*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.94 ms | 1012 KiB | 16 Q