3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [101,4,320,1,2,3,45,46]; $arr1 = usort($arr1); $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 = 10, Position 2 = 27
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 27
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/ncNBr
function name:  (null)
number of ops:  32
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        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !0, $7
    5     5        ASSIGN                                                   !1, <array>
    6     6        ASSIGN                                                   !2, <array>
    7     7        ASSIGN                                                   !3, 0
    8     8        ASSIGN                                                   !4, <true>
   10     9      > FE_RESET_R                                       $13     !0, ->27
         10    > > FE_FETCH_R                                               $13, !5, ->27
   11    11    > > JMPZ                                                     !4, ->15
   12    12    >   ASSIGN_DIM                                               !2
         13        OP_DATA                                                  !5
         14      > JMP                                                      ->26
   14    15    >   INIT_FCALL                                               'end'
         16        SEND_REF                                                 !2
         17        DO_ICALL                                         $15     
         18        ADD                                              ~16     $15, 1
         19        IS_EQUAL                                                 !5, ~16
         20      > JMPZ                                                     ~17, ->24
   15    21    >   ASSIGN_DIM                                               !2
         22        OP_DATA                                                  !5
         23      > JMP                                                      ->26
   17    24    >   ASSIGN                                                   !1, !2
   18    25        ASSIGN                                                   !2, <array>
   10    26    > > JMP                                                      ->10
         27    >   FE_FREE                                                  $13
   23    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
189.62 ms | 1388 KiB | 19 Q