3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'xx' => range(1, 10), 'yy' => range(1, 4) ]; $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/Gujmc
function name:  (null)
number of ops:  30
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'
    3    10        ASSIGN                                                   !0, ~3
    8    11        INIT_FCALL                                               'max'
         12        INIT_FCALL                                               'array_map'
         13        SEND_VAL                                                 'count'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $6      
         16        SEND_VAR                                                 $6
         17        DO_ICALL                                         $7      
         18        ASSIGN                                                   !1, $7
    9    19        INIT_FCALL                                               'array_map'
   10    20        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FGujmc%3A10%240'
         21        BIND_LEXICAL                                             ~9, !1
         22        SEND_VAL                                                 ~9
   11    23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $10     
    9    25        ASSIGN                                                   !0, $10
   14    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FGujmc%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gujmc
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $a, !1 = $length
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     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%2FGujmc%3A10%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.51 ms | 1388 KiB | 23 Q