3v4l.org

run code in 300+ 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 = 25
Branch analysis from position: 25
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 31
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 4
Branch analysis from position: 25
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 4
Branch analysis from position: 25
Branch analysis from position: 4
Branch analysis from position: 17
Branch analysis from position: 31
filename:       /in/RaWTN
function name:  f
number of ops:  34
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                                                      ->25
          2    >   ASSIGN                                                   !1, 0
          3      > JMP                                                      ->17
          4    >   INIT_FCALL                                               'strpos'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $6      
          8        INIT_FCALL                                               'strrpos'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $7      
         12        IS_EQUAL                                         ~8      $6, $7
         13      > JMPZ_EX                                          ~8      ~8, ->17
         14    >   ASSIGN_DIM                                       ~9      !3
         15        OP_DATA                                                  !2
         16        BOOL                                             ~8      ~9
         17    >   INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !0
         19        POST_INC                                         ~10     !1
         20        SEND_VAL                                                 ~10
         21        SEND_VAR                                                 !4
         22        DO_ICALL                                         $11     
         23        ASSIGN                                           ~12     !2, $11
         24      > JMPNZ                                                    ~12, ->4
         25    >   BOOL_NOT                                         ~13     !3
         26      > JMPZ_EX                                          ~13     ~13, ->31
         27    >   PRE_INC                                          ~14     !4
         28        STRLEN                                           ~15     !0
         29        IS_SMALLER                                       ~16     ~14, ~15
         30        BOOL                                             ~13     ~16
         31    > > JMPNZ                                                    ~13, ->2
         32    > > RETURN                                                   !3
         33*     > RETURN                                                   null

End of function f

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.46 ms | 1398 KiB | 29 Q