3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = [1,2]; $b = [3,4]; $newArray = []; foreach ($a as $index => $value) { $newArray[] = [ $a[$index], $b[$index] ]; } // Echo as JSON for readability echo json_encode($newArray);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/okHhQ
function name:  (null)
number of ops:  19
compiled vars:  !0 = $a, !1 = $b, !2 = $newArray, !3 = $value, !4 = $index
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
    6     2        ASSIGN                                                       !2, <array>
    8     3      > FE_RESET_R                                           $8      !0, ->13
          4    > > FE_FETCH_R                                           ~9      $8, !3, ->13
          5    >   ASSIGN                                                       !4, ~9
   10     6        FETCH_DIM_R                                          ~12     !0, !4
          7        INIT_ARRAY                                           ~13     ~12
   11     8        FETCH_DIM_R                                          ~14     !1, !4
          9        ADD_ARRAY_ELEMENT                                    ~13     ~14
    9    10        ASSIGN_DIM                                                   !2
   11    11        OP_DATA                                                      ~13
    8    12      > JMP                                                          ->4
         13    >   FE_FREE                                                      $8
   16    14        INIT_FCALL                                                   'json_encode'
         15        SEND_VAR                                                     !2
         16        DO_ICALL                                             $15     
         17        ECHO                                                         $15
         18      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.48 ms | 1911 KiB | 14 Q