3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'type1' => array( 'id' => 'w12', 'name' => 'John Doe', 'email' => 'john@example.com', 'fname' => 'john', 'phone' => '111', 'age' => '22' ), 'type2' => array( 'id' => 'w13', 'name' => 'Jane Doe', 'email' => 'jane@example.com', 'age' => '22', 'phone' => '111', 'fname' => 'dsd' ), ); $order = [ 'id' => null, 'name' => null, 'fname' => null, 'phone' => null, 'age' => null, 'email' => null ]; $ordered = array_map(function($row) use ($order) { return array_merge($order, $row); }, $array); var_dump($ordered);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rWghu
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array, !1 = $order, !2 = $ordered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   23     1        ASSIGN                                                   !1, <array>
   32     2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FrWghu%3A32%240'
          4        BIND_LEXICAL                                             ~5, !1
   34     5        SEND_VAL                                                 ~5
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
   32     8        ASSIGN                                                   !2, $6
   36     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FrWghu%3A32%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rWghu
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $row, !1 = $order
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   33     2        INIT_FCALL                                               'array_merge'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   34     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FrWghu%3A32%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.88 ms | 1395 KiB | 19 Q