3v4l.org

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

Generated using Vulcan Logic Dumper, using php 7.3.0