3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'id' => 1, 'name' => 'John', 'address' => 'Some address 1', 'city' => 'NY' ], [ 'id' => 2, 'name' => 'Jack', 'address' => 'Some address 2', 'city' => 'NY' ] ]; $keep = ['id' => '', 'name' => '']; var_export( array_map( fn($row) => array_intersect_key($row, $keep), $array ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mRJ0T
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array, !1 = $keep
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, <array>
   19     2        INIT_FCALL                                               'var_export'
   20     3        INIT_FCALL                                               'array_map'
   21     4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !1
          6        SEND_VAL                                                 ~4
   22     7        SEND_VAR                                                 !0
   20     8        DO_ICALL                                         $5      
   22     9        SEND_VAR                                                 $5
   19    10        DO_ICALL                                                 
   24    11      > 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/mRJ0T
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $row, !1 = $keep
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        INIT_FCALL                                               'array_intersect_key'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
          7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.62 ms | 1012 KiB | 16 Q