3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rows = [ [ 'FirstName' => 'Pim', 'Address' => 'Finland', 'LastName' => 'Svensson', 'ID' => 3 ], [ 'FirstName' => 'Emil', 'Address' => 'Sweden', 'LastName' => 'Malm', 'ID' => 5 ] ]; $order = ['ID', 'FirstName', 'LastName', 'Address']; var_export( array_map( function ($row) use ($order) { static $keys = array_flip($order); return array_replace($keys, $row); }, $rows ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rREPH
function name:  (null)
number of ops:  12
compiled vars:  !0 = $rows, !1 = $order
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     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
   24     6        SEND_VAL                                                 ~4
   25     7        SEND_VAR                                                 !0
   20     8        DO_ICALL                                         $5      
   25     9        SEND_VAR                                                 $5
   19    10        DO_ICALL                                                 
   27    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/rREPH
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $row, !1 = $order, !2 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   22     2        ZEND_BIND_INIT_STATIC_OR_JMP                             !2
          3        INIT_FCALL                                               'array_flip'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $3      
          6        BIND_STATIC                                              !2, $3
   23     7        INIT_FCALL                                               'array_replace'
          8        SEND_VAR                                                 !2
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $4      
         11      > RETURN                                                   $4
   24    12*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.67 ms | 1013 KiB | 17 Q