3v4l.org

run code in 500+ 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 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 17
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 24
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 17
Branch analysis from position: 34
Branch analysis from position: 17
Branch analysis from position: 31
Branch analysis from position: 24
filename:       /in/AIo5i
function name:  (null)
number of ops:  38
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        COUNT                                                ~9      !0
          3        COUNT                                                ~10     !1
          4        FRAMELESS_ICALL_2                max                 ~11     ~9, ~10
          5        ASSIGN                                                       !2, ~11
    8     6        INIT_FCALL                                                   'array_keys'
          7        SEND_VAR                                                     !0
          8        DO_ICALL                                             $13     
          9        ASSIGN                                                       !3, $13
    9    10        INIT_FCALL                                                   'array_keys'
         11        SEND_VAR                                                     !1
         12        DO_ICALL                                             $15     
         13        ASSIGN                                                       !4, $15
   11    14        ASSIGN                                                       !5, <array>
   12    15        ASSIGN                                                       !6, 0
         16      > JMP                                                          ->32
   13    17    >   ISSET_ISEMPTY_DIM_OBJ                             0          !3, !6
         18      > JMPZ                                                         ~19, ->24
   14    19    >   FETCH_DIM_R                                          ~20     !3, !6
         20        FETCH_DIM_R                                          ~22     !3, !6
         21        FETCH_DIM_R                                          ~23     !0, ~22
         22        ASSIGN_DIM                                                   !5, ~20
         23        OP_DATA                                                      ~23
   16    24    >   ISSET_ISEMPTY_DIM_OBJ                             0          !4, !6
         25      > JMPZ                                                         ~24, ->31
   17    26    >   FETCH_DIM_R                                          ~25     !4, !6
         27        FETCH_DIM_R                                          ~27     !4, !6
         28        FETCH_DIM_R                                          ~28     !1, ~27
         29        ASSIGN_DIM                                                   !5, ~25
         30        OP_DATA                                                      ~28
   12    31    >   PRE_INC                                                      !6
         32    >   IS_SMALLER                                                   !6, !2
         33      > JMPNZ                                                        ~30, ->17
   20    34    >   INIT_FCALL                                                   'var_export'
         35        SEND_VAR                                                     !5
         36        DO_ICALL                                                     
         37      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
154.15 ms | 1895 KiB | 15 Q