3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ['something', 'something else', 'another something']; $old_value = ""; foreach ($arr as $key => $value) { if ($old_value == $value) { $colour = 'blue'; } else { $colour = 'yellow'; $old_value = $value; } echo 'old_value=' . $old_value; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/k5iEX
function name:  (null)
number of ops:  16
compiled vars:  !0 = $arr, !1 = $old_value, !2 = $value, !3 = $key, !4 = $colour
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, ''
    4     2      > FE_RESET_R                                       $7      !0, ->14
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->14
          4    >   ASSIGN                                                   !3, ~8
    6     5        IS_EQUAL                                                 !1, !2
          6      > JMPZ                                                     ~10, ->9
    8     7    >   ASSIGN                                                   !4, 'blue'
          8      > JMP                                                      ->11
   12     9    >   ASSIGN                                                   !4, 'yellow'
   13    10        ASSIGN                                                   !1, !2
   15    11    >   CONCAT                                           ~14     'old_value%3D', !1
         12        ECHO                                                     ~14
    4    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $7
   17    15      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.22 ms | 1394 KiB | 13 Q