3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [1, 2, 3]; // Ссылка $value на значение массива $array не удаляется после выхода из тела цикла и указывает на последний элемент массива. $array[2] также указывает на последний элемент. foreach ($array as &$value) { } // Каждый проход цикла устанавливается новое значение $value, к-рый указывает на последний элемент. foreach ($array as $key => $value) { echo '$value = ' . $value . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 4
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 4
filename:       /in/SM2CN
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    6     1      > FE_RESET_RW                                      $4      !0, ->4
          2    > > FE_FETCH_RW                                              $4, !1, ->4
          3    > > JMP                                                      ->2
          4    >   FE_FREE                                                  $4
    9     5      > FE_RESET_R                                       $5      !0, ->12
          6    > > FE_FETCH_R                                       ~6      $5, !1, ->12
          7    >   ASSIGN                                                   !2, ~6
   10     8        CONCAT                                           ~8      '%24value+%3D+', !1
          9        CONCAT                                           ~9      ~8, '%0A'
         10        ECHO                                                     ~9
    9    11      > JMP                                                      ->6
         12    >   FE_FREE                                                  $5
   11    13      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.64 ms | 1393 KiB | 13 Q