3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subject = 'in the middle 9850112686331(14-15): for Rocco A & Stephanie'; $arr = preg_split('/[^[:alnum:]]+/', $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)); } } 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 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 9
Branch analysis from position: 32
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 42
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 42
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 11
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 9
Branch analysis from position: 32
Branch analysis from position: 9
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 11
Branch analysis from position: 28
Branch analysis from position: 11
filename:       /in/2YDBn
function name:  (null)
number of ops:  44
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%3A+for+Rocco+A+%26+Stephanie'
    5     1        INIT_FCALL                                               'preg_split'
          2        SEND_VAL                                                 '%2F%5B%5E%5B%3Aalnum%3A%5D%5D%2B%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
    6     6        ASSIGN                                                   !2, <array>
    7     7        ASSIGN                                                   !3, 0
          8      > JMP                                                      ->29
    8     9    >   ASSIGN                                                   !4, !3
         10      > JMP                                                      ->25
    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        ASSIGN_DIM                                               !2
         23        OP_DATA                                                  $16
    8    24        PRE_INC                                                  !4
         25    >   COUNT                                            ~18     !1
         26        IS_SMALLER                                               !4, ~18
         27      > JMPNZ                                                    ~19, ->11
    7    28    >   PRE_INC                                                  !3
         29    >   COUNT                                            ~21     !1
         30        IS_SMALLER                                               !3, ~21
         31      > JMPNZ                                                    ~22, ->9
   13    32    >   INIT_FCALL                                               'usort'
         33        SEND_REF                                                 !2
         34        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2YDBn%3A13%240'
   15    35        SEND_VAL                                                 ~23
         36        DO_ICALL                                                 
   17    37      > FE_RESET_R                                       $25     !2, ->42
         38    > > FE_FETCH_R                                               $25, !5, ->42
   18    39    >   CONCAT                                           ~26     !5, '%0A'
         40        ECHO                                                     ~26
   17    41      > JMP                                                      ->38
         42    >   FE_FREE                                                  $25
   19    43      > RETURN                                                   1

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.32 ms | 1400 KiB | 21 Q