3v4l.org

run code in 500+ PHP versions simultaneously
<?php error_reporting(0); function f($s){while(!$a&&++$i<strlen($s))for($j=0;$b=substr($s,$j++,$i);)strpos($s,$b)==strrpos($s,$b)&&($a[]=$b);return$a;} echo "------\n"; var_dump(f("")); echo "\n"; // -> [""] var_dump(f("abcaa")); // -> ["b","c"] var_dump(f("rererere")); echo "\n"; // -> ["ererer"] var_dump(f("asdfasdfd")); echo "\n"; // -> ["fa","fd"] var_dump(f("ffffhhhhfffffhhhhhfffhhh")); echo "\n"; // -> ["hffff","fffff","hhhhh","hfffh"] var_dump(f("asdfdfasddfdfaddsasadsasadsddsddfdsasdf")); echo "\n"; // -> ["fas","fad","add","fds"] echo "------\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RaWTN
function name:  (null)
number of ops:  47
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                                   'error_reporting'
          1        SEND_VAL                                                     0
          2        DO_ICALL                                                     
    6     3        ECHO                                                         '------%0A'
    7     4        INIT_FCALL                                                   'var_dump'
          5        INIT_FCALL                                                   'f'
          6        SEND_VAL                                                     ''
          7        DO_FCALL                                          0  $1      
          8        SEND_VAR                                                     $1
          9        DO_ICALL                                                     
         10        ECHO                                                         '%0A'
    8    11        INIT_FCALL                                                   'var_dump'
         12        INIT_FCALL                                                   'f'
         13        SEND_VAL                                                     'abcaa'
         14        DO_FCALL                                          0  $3      
         15        SEND_VAR                                                     $3
         16        DO_ICALL                                                     
    9    17        INIT_FCALL                                                   'var_dump'
         18        INIT_FCALL                                                   'f'
         19        SEND_VAL                                                     'rererere'
         20        DO_FCALL                                          0  $5      
         21        SEND_VAR                                                     $5
         22        DO_ICALL                                                     
         23        ECHO                                                         '%0A'
   10    24        INIT_FCALL                                                   'var_dump'
         25        INIT_FCALL                                                   'f'
         26        SEND_VAL                                                     'asdfasdfd'
         27        DO_FCALL                                          0  $7      
         28        SEND_VAR                                                     $7
         29        DO_ICALL                                                     
         30        ECHO                                                         '%0A'
   11    31        INIT_FCALL                                                   'var_dump'
         32        INIT_FCALL                                                   'f'
         33        SEND_VAL                                                     'ffffhhhhfffffhhhhhfffhhh'
         34        DO_FCALL                                          0  $9      
         35        SEND_VAR                                                     $9
         36        DO_ICALL                                                     
         37        ECHO                                                         '%0A'
   12    38        INIT_FCALL                                                   'var_dump'
         39        INIT_FCALL                                                   'f'
         40        SEND_VAL                                                     'asdfdfasddfdfaddsasadsasadsddsddfdsasdf'
         41        DO_FCALL                                          0  $11     
         42        SEND_VAR                                                     $11
         43        DO_ICALL                                                     
         44        ECHO                                                         '%0A'
   13    45        ECHO                                                         '------%0A'
         46      > RETURN                                                       1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 4
Branch analysis from position: 19
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 4
Branch analysis from position: 19
Branch analysis from position: 4
Branch analysis from position: 14
Branch analysis from position: 25
filename:       /in/RaWTN
function name:  f
number of ops:  28
compiled vars:  !0 = $s, !1 = $j, !2 = $b, !3 = $a, !4 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1      > JMP                                                          ->19
          2    >   ASSIGN                                                       !1, 0
          3      > JMP                                                          ->14
          4    >   FRAMELESS_ICALL_2                strpos              ~6      !0, !2
          5        INIT_FCALL                                                   'strrpos'
          6        SEND_VAR                                                     !0
          7        SEND_VAR                                                     !2
          8        DO_ICALL                                             $7      
          9        IS_EQUAL                                             ~8      $7, ~6
         10      > JMPZ_EX                                              ~8      ~8, ->14
         11    >   ASSIGN_DIM                                           ~9      !3
         12        OP_DATA                                                      !2
         13        BOOL                                                 ~8      ~9
         14    >   POST_INC                                             ~10     !1
         15        FRAMELESS_ICALL_3                substr              ~11     !0, ~10
         16        OP_DATA                                                      !4
         17        ASSIGN                                               ~12     !2, ~11
         18      > JMPNZ                                                        ~12, ->4
         19    >   BOOL_NOT                                             ~13     !3
         20      > JMPZ_EX                                              ~13     ~13, ->25
         21    >   PRE_INC                                              ~14     !4
         22        STRLEN                                               ~15     !0
         23        IS_SMALLER                                           ~16     ~14, ~15
         24        BOOL                                                 ~13     ~16
         25    > > JMPNZ                                                        ~13, ->2
         26    > > RETURN                                                       !3
         27*     > RETURN                                                       null

End of function f

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
226.51 ms | 3051 KiB | 26 Q