3v4l.org

run code in 500+ PHP versions simultaneously
<?php $names = [ 'Pérez-González', 'Domínguez-Díaz', 'Güemez-Martínez', 'Johnson-De Sosa', 'Pérez-De la Cruz', 'smith', 'Pérez De la Cruz-González', 'de Gal-O\'Connell', 'Johnson--Johnson' ]; foreach ($names as $name) { echo "$name is " . (!preg_match("~^\pL+(?:[- ']\pL+)*$~u", $name) ? 'in' : '') . "valid\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 15
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/auqSK
function name:  (null)
number of ops:  17
compiled vars:  !0 = $names, !1 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   15     1      > FE_RESET_R                                           $3      !0, ->15
          2    > > FE_FETCH_R                                                   $3, !1, ->15
   16     3    >   NOP                                                          
          4        FAST_CONCAT                                          ~4      !1, '+is+'
          5        FRAMELESS_ICALL_2                preg_match          ~5      '%7E%5E%5CpL%2B%28%3F%3A%5B-+%27%5D%5CpL%2B%29%2A%24%7Eu', !1
          6        BOOL_NOT                                             ~6      ~5
          7      > JMPZ                                                         ~6, ->10
          8    >   QM_ASSIGN                                            ~7      'in'
          9      > JMP                                                          ->11
         10    >   QM_ASSIGN                                            ~7      ''
         11    >   CONCAT                                               ~8      ~4, ~7
         12        CONCAT                                               ~9      ~8, 'valid%0A'
         13        ECHO                                                         ~9
   15    14      > JMP                                                          ->2
         15    >   FE_FREE                                                      $3
   17    16      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.11 ms | 2040 KiB | 13 Q