3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subject = 'in the middle 9850112686331(14-15) for Rocco A & Stephanie'; $arr = explode(' ', $subject); $candidates = []; for ($i = 0; $i < count($arr); $i++) { for ($j = $i; $j < count($arr); $j++) { $candidates[] = implode(' ', array_slice($arr, $i, $j - $i + 1)) . PHP_EOL; } } usort($candidates, function($a, $b) { return strlen($b) - strlen($a); }); foreach($candidates as $candidate){ echo $candidate . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 9
Branch analysis from position: 33
2 jumps found. (Code = 77) Position 1 = 39, Position 2 = 43
Branch analysis from position: 39
2 jumps found. (Code = 78) Position 1 = 40, Position 2 = 43
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 11
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 9
Branch analysis from position: 33
Branch analysis from position: 9
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 11
Branch analysis from position: 29
Branch analysis from position: 11
filename:       /in/KeME5
function name:  (null)
number of ops:  45
compiled vars:  !0 = $subject, !1 = $arr, !2 = $candidates, !3 = $i, !4 = $j, !5 = $candidate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'in+the+middle+9850112686331%2814-15%29+for+Rocco+A+%26+Stephanie'
    5     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
    6     6        ASSIGN                                                   !2, <array>
    7     7        ASSIGN                                                   !3, 0
          8      > JMP                                                      ->30
    8     9    >   ASSIGN                                                   !4, !3
         10      > JMP                                                      ->26
    9    11    >   INIT_FCALL                                               'implode'
         12        SEND_VAL                                                 '+'
         13        INIT_FCALL                                               'array_slice'
         14        SEND_VAR                                                 !1
         15        SEND_VAR                                                 !3
         16        SUB                                              ~13     !4, !3
         17        ADD                                              ~14     ~13, 1
         18        SEND_VAL                                                 ~14
         19        DO_ICALL                                         $15     
         20        SEND_VAR                                                 $15
         21        DO_ICALL                                         $16     
         22        CONCAT                                           ~17     $16, '%0A'
         23        ASSIGN_DIM                                               !2
         24        OP_DATA                                                  ~17
    8    25        PRE_INC                                                  !4
         26    >   COUNT                                            ~19     !1
         27        IS_SMALLER                                               !4, ~19
         28      > JMPNZ                                                    ~20, ->11
    7    29    >   PRE_INC                                                  !3
         30    >   COUNT                                            ~22     !1
         31        IS_SMALLER                                               !3, ~22
         32      > JMPNZ                                                    ~23, ->9
   13    33    >   INIT_FCALL                                               'usort'
         34        SEND_REF                                                 !2
         35        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKeME5%3A13%240'
   15    36        SEND_VAL                                                 ~24
         37        DO_ICALL                                                 
   17    38      > FE_RESET_R                                       $26     !2, ->43
         39    > > FE_FETCH_R                                               $26, !5, ->43
   18    40    >   CONCAT                                           ~27     !5, '%0A'
         41        ECHO                                                     ~27
   17    42      > JMP                                                      ->39
         43    >   FE_FREE                                                  $26
   19    44      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FKeME5%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KeME5
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        STRLEN                                           ~2      !1
          3        STRLEN                                           ~3      !0
          4        SUB                                              ~4      ~2, ~3
          5      > RETURN                                                   ~4
   15     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKeME5%3A13%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.38 ms | 1400 KiB | 21 Q