3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'xx' => range(1, 10), 'yy' => range(1, 4), 'zz' => range(1, 6) ]; $length = max(array_map('count', $array)); $array = array_map( function (array $a) use ($length) { return array_pad($a, $length, null); }, $array ); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TKFGB
function name:  (null)
number of ops:  35
compiled vars:  !0 = $array, !1 = $length
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 10
          3        DO_ICALL                                         $2      
          4        INIT_ARRAY                                       ~3      $2, 'xx'
    5     5        INIT_FCALL                                               'range'
          6        SEND_VAL                                                 1
          7        SEND_VAL                                                 4
          8        DO_ICALL                                         $4      
          9        ADD_ARRAY_ELEMENT                                ~3      $4, 'yy'
    6    10        INIT_FCALL                                               'range'
         11        SEND_VAL                                                 1
         12        SEND_VAL                                                 6
         13        DO_ICALL                                         $5      
         14        ADD_ARRAY_ELEMENT                                ~3      $5, 'zz'
    3    15        ASSIGN                                                   !0, ~3
    9    16        INIT_FCALL                                               'max'
         17        INIT_FCALL                                               'array_map'
         18        SEND_VAL                                                 'count'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                         $7      
         21        SEND_VAR                                                 $7
         22        DO_ICALL                                         $8      
         23        ASSIGN                                                   !1, $8
   10    24        INIT_FCALL                                               'array_map'
   11    25        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FTKFGB%3A11%240'
         26        BIND_LEXICAL                                             ~10, !1
         27        SEND_VAL                                                 ~10
   12    28        SEND_VAR                                                 !0
         29        DO_ICALL                                         $11     
   10    30        ASSIGN                                                   !0, $11
   15    31        INIT_FCALL                                               'print_r'
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FTKFGB%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TKFGB
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $a, !1 = $length
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        INIT_FCALL                                               'array_pad'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_VAL                                                 null
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
          8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FTKFGB%3A11%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.78 ms | 1400 KiB | 23 Q