3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [1,2]; foreach($array as &$a) { if ($a == 1) { $array[] = 3; } echo $a . "\n"; } var_dump($array); echo "----------\n"; foreach($array as $a) { var_dump($a); echo $a . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 7
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 10
filename:       /in/WOAsu
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1      > FE_RESET_RW                                      $3      !0, ->10
          2    > > FE_FETCH_RW                                              $3, !1, ->10
    6     3    >   IS_EQUAL                                                 !1, 1
          4      > JMPZ                                                     ~4, ->7
    7     5    >   ASSIGN_DIM                                               !0
          6        OP_DATA                                                  3
    9     7    >   CONCAT                                           ~6      !1, '%0A'
          8        ECHO                                                     ~6
    5     9      > JMP                                                      ->2
         10    >   FE_FREE                                                  $3
   12    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
   14    14        ECHO                                                     '----------%0A'
   16    15      > FE_RESET_R                                       $8      !0, ->23
         16    > > FE_FETCH_R                                               $8, !1, ->23
   18    17    >   INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
   20    20        CONCAT                                           ~10     !1, '%0A'
         21        ECHO                                                     ~10
   16    22      > JMP                                                      ->16
         23    >   FE_FREE                                                  $8
   21    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.89 ms | 1396 KiB | 15 Q