3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = ['a' => '1','b' => 2]; $arr2 = ['h' => 'c','j' => '3']; $max = max(count($arr1), count($arr2)); $keys1 = array_keys($arr1); $keys2 = array_keys($arr2); $result = []; for ($x = 0; $x < $max; ++$x) { if (isset($keys1[$x])) { $result[$keys1[$x]] = $arr1[$keys1[$x]]; } if (isset($keys2[$x])) { $result[$keys2[$x]] = $arr2[$keys2[$x]]; } } var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 20
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 34
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 20
Branch analysis from position: 37
Branch analysis from position: 20
Branch analysis from position: 34
Branch analysis from position: 27
filename:       /in/AIo5i
function name:  (null)
number of ops:  41
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $max, !3 = $keys1, !4 = $keys2, !5 = $result, !6 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    7     2        INIT_FCALL                                               'max'
          3        COUNT                                            ~9      !0
          4        SEND_VAL                                                 ~9
          5        COUNT                                            ~10     !1
          6        SEND_VAL                                                 ~10
          7        DO_ICALL                                         $11     
          8        ASSIGN                                                   !2, $11
    8     9        INIT_FCALL                                               'array_keys'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $13     
         12        ASSIGN                                                   !3, $13
    9    13        INIT_FCALL                                               'array_keys'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $15     
         16        ASSIGN                                                   !4, $15
   11    17        ASSIGN                                                   !5, <array>
   12    18        ASSIGN                                                   !6, 0
         19      > JMP                                                      ->35
   13    20    >   ISSET_ISEMPTY_DIM_OBJ                         0          !3, !6
         21      > JMPZ                                                     ~19, ->27
   14    22    >   FETCH_DIM_R                                      ~20     !3, !6
         23        FETCH_DIM_R                                      ~22     !3, !6
         24        FETCH_DIM_R                                      ~23     !0, ~22
         25        ASSIGN_DIM                                               !5, ~20
         26        OP_DATA                                                  ~23
   16    27    >   ISSET_ISEMPTY_DIM_OBJ                         0          !4, !6
         28      > JMPZ                                                     ~24, ->34
   17    29    >   FETCH_DIM_R                                      ~25     !4, !6
         30        FETCH_DIM_R                                      ~27     !4, !6
         31        FETCH_DIM_R                                      ~28     !1, ~27
         32        ASSIGN_DIM                                               !5, ~25
         33        OP_DATA                                                  ~28
   12    34    >   PRE_INC                                                  !6
         35    >   IS_SMALLER                                               !6, !2
         36      > JMPNZ                                                    ~30, ->20
   20    37    >   INIT_FCALL                                               'var_export'
         38        SEND_VAR                                                 !5
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.36 ms | 1009 KiB | 16 Q