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); }); print_r($candidates);
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
1 jumps found. (Code = 62) Position 1 = -2
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/X5UsT
function name:  (null)
number of ops:  42
compiled vars:  !0 = $subject, !1 = $arr, !2 = $candidates, !3 = $i, !4 = $j
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                                         $6      
          5        ASSIGN                                                   !1, $6
    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                                              ~12     !4, !3
         17        ADD                                              ~13     ~12, 1
         18        SEND_VAL                                                 ~13
         19        DO_ICALL                                         $14     
         20        SEND_VAR                                                 $14
         21        DO_ICALL                                         $15     
         22        CONCAT                                           ~16     $15, '%0A'
         23        ASSIGN_DIM                                               !2
         24        OP_DATA                                                  ~16
    8    25        PRE_INC                                                  !4
         26    >   COUNT                                            ~18     !1
         27        IS_SMALLER                                               !4, ~18
         28      > JMPNZ                                                    ~19, ->11
    7    29    >   PRE_INC                                                  !3
         30    >   COUNT                                            ~21     !1
         31        IS_SMALLER                                               !3, ~21
         32      > JMPNZ                                                    ~22, ->9
   13    33    >   INIT_FCALL                                               'usort'
         34        SEND_REF                                                 !2
         35        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FX5UsT%3A13%240'
   15    36        SEND_VAL                                                 ~23
         37        DO_ICALL                                                 
   17    38        INIT_FCALL                                               'print_r'
         39        SEND_VAR                                                 !2
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FX5UsT%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X5UsT
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%2FX5UsT%3A13%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.54 ms | 1405 KiB | 23 Q