3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array1 = array('a','b','c','d','x','u','xx'); $array2 = array('e','f','g','h','s','d','t'); $array3 = array('i','j','k','l'); $array = [$array1, $array2, $array3]; $maxCount = max(array_map('count', $array)); $result = []; for ($i = 0; $i < $maxCount; ++$i) { foreach (array_column($array, $i) as $found) { $result[] = $found; } } var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 18
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 18
Branch analysis from position: 31
Branch analysis from position: 18
Branch analysis from position: 27
filename:       /in/UooDR
function name:  (null)
number of ops:  35
compiled vars:  !0 = $array1, !1 = $array2, !2 = $array3, !3 = $array, !4 = $maxCount, !5 = $result, !6 = $i, !7 = $found
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
    5     2        ASSIGN                                                       !2, <array>
    6     3        INIT_ARRAY                                           ~11     !0
          4        ADD_ARRAY_ELEMENT                                    ~11     !1
          5        ADD_ARRAY_ELEMENT                                    ~11     !2
          6        ASSIGN                                                       !3, ~11
    8     7        INIT_FCALL                                                   'max'
          8        INIT_FCALL                                                   'array_map'
          9        SEND_VAL                                                     'count'
         10        SEND_VAR                                                     !3
         11        DO_ICALL                                             $13     
         12        SEND_VAR                                                     $13
         13        DO_ICALL                                             $14     
         14        ASSIGN                                                       !4, $14
    9    15        ASSIGN                                                       !5, <array>
   10    16        ASSIGN                                                       !6, 0
         17      > JMP                                                          ->29
   11    18    >   INIT_FCALL                                                   'array_column'
         19        SEND_VAR                                                     !3
         20        SEND_VAR                                                     !6
         21        DO_ICALL                                             $18     
         22      > FE_RESET_R                                           $19     $18, ->27
         23    > > FE_FETCH_R                                                   $19, !7, ->27
   12    24    >   ASSIGN_DIM                                                   !5
         25        OP_DATA                                                      !7
   11    26      > JMP                                                          ->23
         27    >   FE_FREE                                                      $19
   10    28        PRE_INC                                                      !6
         29    >   IS_SMALLER                                                   !6, !4
         30      > JMPNZ                                                        ~22, ->18
   15    31    >   INIT_FCALL                                                   'var_export'
         32        SEND_VAR                                                     !5
         33        DO_ICALL                                                     
         34      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.54 ms | 1911 KiB | 17 Q