3v4l.org

run code in 300+ PHP versions simultaneously
<?php function search($input) { $result = $input; for($a=0;$a<count($input);$a++) { for($b=0;$b<count($input);$b++) { $d=""; for($c=1;$c<$b;$c++) { $d = $d . $input[$a+$c]; print $a + $c; } $result[]= $d; } } return array_filter(array_unique($result)); } print json_encode(search(["a", "b"])) . "\n"; print json_encode(search(["a", "b", "c"]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iO5F6
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'json_encode'
          1        INIT_FCALL                                               'search'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                         $1      
          6        CONCAT                                           ~2      $1, '%0A'
          7        ECHO                                                     ~2
   25     8        INIT_FCALL                                               'json_encode'
          9        INIT_FCALL                                               'search'
         10        SEND_VAL                                                 <array>
         11        DO_FCALL                                      0  $3      
         12        SEND_VAR                                                 $3
         13        DO_ICALL                                         $4      
         14        ECHO                                                     $4
         15      > RETURN                                                   1

Function search:
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 = 44) Position 1 = 28, Position 2 = 4
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 6
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 4
Branch analysis from position: 28
Branch analysis from position: 4
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 9
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 6
Branch analysis from position: 24
Branch analysis from position: 6
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 9
Branch analysis from position: 18
Branch analysis from position: 9
filename:       /in/iO5F6
function name:  search
number of ops:  36
compiled vars:  !0 = $input, !1 = $result, !2 = $a, !3 = $b, !4 = $d, !5 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, !0
    7     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->25
    9     4    >   ASSIGN                                                   !3, 0
          5      > JMP                                                      ->21
   11     6    >   ASSIGN                                                   !4, ''
   12     7        ASSIGN                                                   !5, 1
          8      > JMP                                                      ->16
   14     9    >   ADD                                              ~11     !2, !5
         10        FETCH_DIM_R                                      ~12     !0, ~11
         11        CONCAT                                           ~13     !4, ~12
         12        ASSIGN                                                   !4, ~13
   15    13        ADD                                              ~15     !2, !5
         14        ECHO                                                     ~15
   12    15        PRE_INC                                                  !5
         16    >   IS_SMALLER                                               !5, !3
         17      > JMPNZ                                                    ~17, ->9
   17    18    >   ASSIGN_DIM                                               !1
         19        OP_DATA                                                  !4
    9    20        PRE_INC                                                  !3
         21    >   COUNT                                            ~20     !0
         22        IS_SMALLER                                               !3, ~20
         23      > JMPNZ                                                    ~21, ->6
    7    24    >   PRE_INC                                                  !2
         25    >   COUNT                                            ~23     !0
         26        IS_SMALLER                                               !2, ~23
         27      > JMPNZ                                                    ~24, ->4
   21    28    >   INIT_FCALL                                               'array_filter'
         29        INIT_FCALL                                               'array_unique'
         30        SEND_VAR                                                 !1
         31        DO_ICALL                                         $25     
         32        SEND_VAR                                                 $25
         33        DO_ICALL                                         $26     
         34      > RETURN                                                   $26
   22    35*     > RETURN                                                   null

End of function search

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.81 ms | 1403 KiB | 21 Q