3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = ['aa', 'ab', 'ba']; $current = ''; foreach($result as $val){ if($val[0] != $current) { echo 'header'; $current = $val[0]; } echo $val; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/ZK5Pp
function name:  (null)
number of ops:  14
compiled vars:  !0 = $result, !1 = $current, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, ''
    6     2      > FE_RESET_R                                       $5      !0, ->12
          3    > > FE_FETCH_R                                               $5, !2, ->12
    7     4    >   FETCH_DIM_R                                      ~6      !2, 0
          5        IS_NOT_EQUAL                                             !1, ~6
          6      > JMPZ                                                     ~7, ->10
    9     7    >   ECHO                                                     'header'
   10     8        FETCH_DIM_R                                      ~8      !2, 0
          9        ASSIGN                                                   !1, ~8
   13    10    >   ECHO                                                     !2
    6    11      > JMP                                                      ->3
         12    >   FE_FREE                                                  $5
   14    13      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.75 ms | 1393 KiB | 13 Q