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

End of function search

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.07 ms | 1402 KiB | 21 Q