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); unset($a); 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 = 17, Position 2 = 24
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 10
filename:       /in/HXKqi
function name:  (null)
number of ops:  26
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        UNSET_CV                                                 !1
   16    15        ECHO                                                     '----------%0A'
   18    16      > FE_RESET_R                                       $8      !0, ->24
         17    > > FE_FETCH_R                                               $8, !1, ->24
   20    18    >   INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
   22    21        CONCAT                                           ~10     !1, '%0A'
         22        ECHO                                                     ~10
   18    23      > JMP                                                      ->17
         24    >   FE_FREE                                                  $8
   23    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.36 ms | 1396 KiB | 15 Q