3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [1,2]; foreach ($array as $i => $v) { if ($i === 0) { $array[1] = 3; } echo "$i: $v\n"; } $array = [1,2]; for ($i=0; $i < count($array); $i++) { if ($i === 0) { $array[1] = 3; } echo "$i: $array[$i]\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 14
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 8
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 18
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 18
Branch analysis from position: 32
Branch analysis from position: 18
Branch analysis from position: 22
Branch analysis from position: 14
filename:       /in/i5RPC
function name:  (null)
number of ops:  33
compiled vars:  !0 = $array, !1 = $v, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1      > FE_RESET_R                                       $4      !0, ->14
          2    > > FE_FETCH_R                                       ~5      $4, !1, ->14
          3    >   ASSIGN                                                   !2, ~5
    5     4        IS_IDENTICAL                                             !2, 0
          5      > JMPZ                                                     ~7, ->8
    6     6    >   ASSIGN_DIM                                               !0, 1
          7        OP_DATA                                                  3
    8     8    >   ROPE_INIT                                     4  ~10     !2
          9        ROPE_ADD                                      1  ~10     ~10, '%3A+'
         10        ROPE_ADD                                      2  ~10     ~10, !1
         11        ROPE_END                                      3  ~9      ~10, '%0A'
         12        ECHO                                                     ~9
    4    13      > JMP                                                      ->2
         14    >   FE_FREE                                                  $4
   10    15        ASSIGN                                                   !0, <array>
   11    16        ASSIGN                                                   !2, 0
         17      > JMP                                                      ->29
   12    18    >   IS_IDENTICAL                                             !2, 0
         19      > JMPZ                                                     ~14, ->22
   13    20    >   ASSIGN_DIM                                               !0, 1
         21        OP_DATA                                                  3
   15    22    >   ROPE_INIT                                     4  ~18     !2
         23        ROPE_ADD                                      1  ~18     ~18, '%3A+'
         24        FETCH_DIM_R                                      ~16     !0, !2
         25        ROPE_ADD                                      2  ~18     ~18, ~16
         26        ROPE_END                                      3  ~17     ~18, '%0A'
         27        ECHO                                                     ~17
   11    28        PRE_INC                                                  !2
         29    >   COUNT                                            ~21     !0
         30        IS_SMALLER                                               !2, ~21
         31      > JMPNZ                                                    ~22, ->18
   16    32    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
126.81 ms | 1399 KiB | 13 Q