3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'moooozeee'; // The regex matches any character -> . in a capture group () // plus as much identical characters as possible following it -> \1+ $pattern = '/(.)\1+/'; preg_match_all($pattern, $string, $m); // sort by their length usort($m[0], function($a, $b) { return (strlen($a) < strlen($b)) ? 1 : -1; }); echo "Longest sequence: " . $m[0][0] . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DPV15
function name:  (null)
number of ops:  19
compiled vars:  !0 = $string, !1 = $pattern, !2 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'moooozeee'
    5     1        ASSIGN                                                   !1, '%2F%28.%29%5C1%2B%2F'
    7     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    9     7        INIT_FCALL                                               'usort'
          8        FETCH_DIM_W                                      $6      !2, 0
          9        SEND_REF                                                 $6
         10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FDPV15%3A9%240'
   11    11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
   13    13        FETCH_DIM_R                                      ~9      !2, 0
         14        FETCH_DIM_R                                      ~10     ~9, 0
         15        CONCAT                                           ~11     'Longest+sequence%3A+', ~10
         16        CONCAT                                           ~12     ~11, '%0A'
         17        ECHO                                                     ~12
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FDPV15%3A9%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DPV15
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        STRLEN                                           ~2      !0
          3        STRLEN                                           ~3      !1
          4        IS_SMALLER                                               ~2, ~3
          5      > JMPZ                                                     ~4, ->8
          6    >   QM_ASSIGN                                        ~5      1
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~5      -1
          9    > > RETURN                                                   ~5
   11    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FDPV15%3A9%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.21 ms | 1388 KiB | 17 Q