3v4l.org

run code in 300+ PHP versions simultaneously
<?php function check($input, $length = 4) { $sequence = "abcdefghijklmnopqrstuvwxyz"; $sequence .= substr($sequence, 0, $length - 1); // abcdefghijklmnopqrstuvwxyz is converted to abcdefghijklmnopqrstuvwxyzabc for ($i = 0; $i < strlen($sequence) - $length; $i++) { // loop runs for $i = 0...25 if (strpos($input, substr($sequence, $i, $length)) !== false) { echo sprintf('"%s" contains "%s"' . "\n", $input, substr($sequence, $i, $length)); return true; } } echo sprintf('"%s" is OK' . "\n", $input); return false; } check("youlookgreatbcdetoday"); // "youlookgreatbcdetoday" contains "bcde" check("youlookgreatklmtoday"); // "youlookgreatklmtoday" is OK check("youlookgreattoday"); // "youlookgreattoday" is OK check("youlookgreattodayza"); // "youlookgreattodayza" is OK check("youlookgreattodayzab"); // "youlookgreattodayzab" contains "yzab"
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YF523
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'check'
          1        SEND_VAL                                                 'youlookgreatbcdetoday'
          2        DO_FCALL                                      0          
   18     3        INIT_FCALL                                               'check'
          4        SEND_VAL                                                 'youlookgreatklmtoday'
          5        DO_FCALL                                      0          
   19     6        INIT_FCALL                                               'check'
          7        SEND_VAL                                                 'youlookgreattoday'
          8        DO_FCALL                                      0          
   20     9        INIT_FCALL                                               'check'
         10        SEND_VAL                                                 'youlookgreattodayza'
         11        DO_FCALL                                      0          
   21    12        INIT_FCALL                                               'check'
         13        SEND_VAL                                                 'youlookgreattodayzab'
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Function check:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 12
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 35
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 12
Branch analysis from position: 40
Branch analysis from position: 12
filename:       /in/YF523
function name:  check
number of ops:  47
compiled vars:  !0 = $input, !1 = $length, !2 = $sequence, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      4
    4     2        ASSIGN                                                   !2, 'abcdefghijklmnopqrstuvwxyz'
    5     3        INIT_FCALL                                               'substr'
          4        SEND_VAR                                                 !2
          5        SEND_VAL                                                 0
          6        SUB                                              ~5      !1, 1
          7        SEND_VAL                                                 ~5
          8        DO_ICALL                                         $6      
          9        ASSIGN_OP                                     8          !2, $6
    7    10        ASSIGN                                                   !3, 0
         11      > JMP                                                      ->36
    9    12    >   INIT_FCALL                                               'strpos'
         13        SEND_VAR                                                 !0
         14        INIT_FCALL                                               'substr'
         15        SEND_VAR                                                 !2
         16        SEND_VAR                                                 !3
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $9      
         19        SEND_VAR                                                 $9
         20        DO_ICALL                                         $10     
         21        TYPE_CHECK                                  1018          $10
         22      > JMPZ                                                     ~11, ->35
   10    23    >   INIT_FCALL                                               'sprintf'
         24        SEND_VAL                                                 '%22%25s%22+contains+%22%25s%22%0A'
         25        SEND_VAR                                                 !0
         26        INIT_FCALL                                               'substr'
         27        SEND_VAR                                                 !2
         28        SEND_VAR                                                 !3
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                         $12     
         31        SEND_VAR                                                 $12
         32        DO_ICALL                                         $13     
         33        ECHO                                                     $13
   11    34      > RETURN                                                   <true>
    7    35    >   PRE_INC                                                  !3
         36    >   STRLEN                                           ~15     !2
         37        SUB                                              ~16     ~15, !1
         38        IS_SMALLER                                               !3, ~16
         39      > JMPNZ                                                    ~17, ->12
   14    40    >   INIT_FCALL                                               'sprintf'
         41        SEND_VAL                                                 '%22%25s%22+is+OK%0A'
         42        SEND_VAR                                                 !0
         43        DO_ICALL                                         $18     
         44        ECHO                                                     $18
   15    45      > RETURN                                                   <false>
   16    46*     > RETURN                                                   null

End of function check

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.86 ms | 1403 KiB | 24 Q