3v4l.org

run code in 300+ PHP versions simultaneously
<?php $headers = ['Color', 'Length', 'Waist']; $data = [ [ ['green', 'Color'], ['23', 'Length'], ], [], [ ['23', 'Length'], ['24', 'Waist'], ], ]; $defaults = array_fill_keys($headers, null); var_export( array_map( function($item) use($defaults) { return array_replace($defaults, array_column($item, 0, 1)); }, $data ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uD9Pg
function name:  (null)
number of ops:  17
compiled vars:  !0 = $headers, !1 = $data, !2 = $defaults
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
   17     2        INIT_FCALL                                               'array_fill_keys'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 null
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   18     7        INIT_FCALL                                               'var_export'
   19     8        INIT_FCALL                                               'array_map'
   20     9        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         10        BIND_LEXICAL                                             ~7, !2
   22    11        SEND_VAL                                                 ~7
   23    12        SEND_VAR                                                 !1
   19    13        DO_ICALL                                         $8      
   23    14        SEND_VAR                                                 $8
   18    15        DO_ICALL                                                 
   25    16      > 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/uD9Pg
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $item, !1 = $defaults
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   21     2        INIT_FCALL                                               'array_replace'
          3        SEND_VAR                                                 !1
          4        INIT_FCALL                                               'array_column'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 0
          7        SEND_VAL                                                 1
          8        DO_ICALL                                         $2      
          9        SEND_VAR                                                 $2
         10        DO_ICALL                                         $3      
         11      > RETURN                                                   $3
   22    12*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
132.76 ms | 1010 KiB | 18 Q