3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = [1,2,3,4,5]; $y = [2,3,4,5,7]; $z = [10,11,12,13,14]; $f = [2,3,4,5,14]; function check(array $x) { sort($x); $isStraight = true; $lastNum = $x[0]; for ($a = 1; $a < 5; $a ++) { if (($lastNum +1) != $x[$a]) { $isStraight = false; } $lastNum = $x[$a]; } if (!$isStraight && $x[0] == 2 && $x[4] == 14) { $x[4] = 1; $isStraight = check($x); } return $isStraight; } var_dump(check($x)); var_dump(check($y)); var_dump(check($z)); var_dump(check($f));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RReXi
function name:  (null)
number of ops:  29
compiled vars:  !0 = $x, !1 = $y, !2 = $z, !3 = $f
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, <array>
   25     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'check'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $8      
          8        SEND_VAR                                                 $8
          9        DO_ICALL                                                 
   26    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'check'
         12        SEND_VAR                                                 !1
         13        DO_FCALL                                      0  $10     
         14        SEND_VAR                                                 $10
         15        DO_ICALL                                                 
   27    16        INIT_FCALL                                               'var_dump'
         17        INIT_FCALL                                               'check'
         18        SEND_VAR                                                 !2
         19        DO_FCALL                                      0  $12     
         20        SEND_VAR                                                 $12
         21        DO_ICALL                                                 
   28    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'check'
         24        SEND_VAR                                                 !3
         25        DO_FCALL                                      0  $14     
         26        SEND_VAR                                                 $14
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Function check:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 9
Branch analysis from position: 19
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
2 jumps found. (Code = 46) Position 1 = 25, Position 2 = 28
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 35
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
Branch analysis from position: 28
Branch analysis from position: 24
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 9
Branch analysis from position: 19
Branch analysis from position: 9
Branch analysis from position: 14
filename:       /in/RReXi
function name:  check
number of ops:  37
compiled vars:  !0 = $x, !1 = $isStraight, !2 = $lastNum, !3 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'sort'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
   10     4        ASSIGN                                                   !1, <true>
   11     5        FETCH_DIM_R                                      ~6      !0, 0
          6        ASSIGN                                                   !2, ~6
   12     7        ASSIGN                                                   !3, 1
          8      > JMP                                                      ->17
   13     9    >   ADD                                              ~9      !2, 1
         10        FETCH_DIM_R                                      ~10     !0, !3
         11        IS_NOT_EQUAL                                             ~9, ~10
         12      > JMPZ                                                     ~11, ->14
   14    13    >   ASSIGN                                                   !1, <false>
   16    14    >   FETCH_DIM_R                                      ~13     !0, !3
         15        ASSIGN                                                   !2, ~13
   12    16        PRE_INC                                                  !3
         17    >   IS_SMALLER                                               !3, 5
         18      > JMPNZ                                                    ~16, ->9
   18    19    >   BOOL_NOT                                         ~17     !1
         20      > JMPZ_EX                                          ~17     ~17, ->24
         21    >   FETCH_DIM_R                                      ~18     !0, 0
         22        IS_EQUAL                                         ~19     ~18, 2
         23        BOOL                                             ~17     ~19
         24    > > JMPZ_EX                                          ~17     ~17, ->28
         25    >   FETCH_DIM_R                                      ~20     !0, 4
         26        IS_EQUAL                                         ~21     ~20, 14
         27        BOOL                                             ~17     ~21
         28    > > JMPZ                                                     ~17, ->35
   19    29    >   ASSIGN_DIM                                               !0, 4
         30        OP_DATA                                                  1
   20    31        INIT_FCALL_BY_NAME                                       'check'
         32        SEND_VAR_EX                                              !0
         33        DO_FCALL                                      0  $23     
         34        ASSIGN                                                   !1, $23
   22    35    > > RETURN                                                   !1
   23    36*     > RETURN                                                   null

End of function check

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
196.08 ms | 1403 KiB | 21 Q