3v4l.org

run code in 500+ PHP versions simultaneously
<?php $pattern = "~(?|^(\w+)|\G(?!^)\h+(\w+))(?:\h+<([^<>\r\n]+)>$)?~"; $strings = [ "Some User Name ", "Some User Name <user.mail@address>" ]; foreach ($strings as $str) { preg_match_all($pattern, $str, $matches); print_r($matches[1]); print_r(array_filter($matches[2])); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/Z1Bmm
function name:  (null)
number of ops:  23
compiled vars:  !0 = $pattern, !1 = $strings, !2 = $str, !3 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%7E%28%3F%7C%5E%28%5Cw%2B%29%7C%5CG%28%3F%21%5E%29%5Ch%2B%28%5Cw%2B%29%29%28%3F%3A%5Ch%2B%3C%28%5B%5E%3C%3E%0D%0A%5D%2B%29%3E%24%29%3F%7E'
    4     1        ASSIGN                                                       !1, <array>
    9     2      > FE_RESET_R                                           $6      !1, ->21
          3    > > FE_FETCH_R                                                   $6, !2, ->21
   10     4    >   INIT_FCALL                                                   'preg_match_all'
          5        SEND_VAR                                                     !0
          6        SEND_VAR                                                     !2
          7        SEND_REF                                                     !3
          8        DO_ICALL                                                     
   11     9        INIT_FCALL                                                   'print_r'
         10        FETCH_DIM_R                                          ~8      !3, 1
         11        SEND_VAL                                                     ~8
         12        DO_ICALL                                                     
   12    13        INIT_FCALL                                                   'print_r'
         14        INIT_FCALL                                                   'array_filter'
         15        FETCH_DIM_R                                          ~10     !3, 2
         16        SEND_VAL                                                     ~10
         17        DO_ICALL                                             $11     
         18        SEND_VAR                                                     $11
         19        DO_ICALL                                                     
    9    20      > JMP                                                          ->3
         21    >   FE_FREE                                                      $6
   13    22      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
128.22 ms | 480 KiB | 10 Q