3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [1,2,3,4,45,78,110]; $longestSeq = array(); $tempSeq = array(); $countSeq = 0; $start = true; foreach($arr1 as $arr) { if($start){ $tempSeq[] = $arr; } else { if(end($tempSeq)+1 == $arr){ $tempSeq[] = $arr; } else { $longestSeq = $tempSeq; $tempSeq = array(); } } } var_dump($longestSeq);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 23
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/5eYv6
function name:  (null)
number of ops:  28
compiled vars:  !0 = $arr1, !1 = $longestSeq, !2 = $tempSeq, !3 = $countSeq, !4 = $start, !5 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    6     3        ASSIGN                                                   !3, 0
    7     4        ASSIGN                                                   !4, <true>
    9     5      > FE_RESET_R                                       $11     !0, ->23
          6    > > FE_FETCH_R                                               $11, !5, ->23
   10     7    > > JMPZ                                                     !4, ->11
   11     8    >   ASSIGN_DIM                                               !2
          9        OP_DATA                                                  !5
         10      > JMP                                                      ->22
   13    11    >   INIT_FCALL                                               'end'
         12        SEND_REF                                                 !2
         13        DO_ICALL                                         $13     
         14        ADD                                              ~14     $13, 1
         15        IS_EQUAL                                                 !5, ~14
         16      > JMPZ                                                     ~15, ->20
   14    17    >   ASSIGN_DIM                                               !2
         18        OP_DATA                                                  !5
         19      > JMP                                                      ->22
   16    20    >   ASSIGN                                                   !1, !2
   17    21        ASSIGN                                                   !2, <array>
    9    22    > > JMP                                                      ->6
         23    >   FE_FREE                                                  $11
   22    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.66 ms | 1396 KiB | 17 Q