3v4l.org

run code in 300+ 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 = 18
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/auqSK
function name:  (null)
number of ops:  20
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, ->18
          2    > > FE_FETCH_R                                               $3, !1, ->18
   16     3    >   NOP                                                      
          4        FAST_CONCAT                                      ~4      !1, '+is+'
          5        INIT_FCALL                                               'preg_match'
          6        SEND_VAL                                                 '%7E%5E%5CpL%2B%28%3F%3A%5B-+%27%5D%5CpL%2B%29%2A%24%7Eu'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $5      
          9        BOOL_NOT                                         ~6      $5
         10      > JMPZ                                                     ~6, ->13
         11    >   QM_ASSIGN                                        ~7      'in'
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~7      ''
         14    >   CONCAT                                           ~8      ~4, ~7
         15        CONCAT                                           ~9      ~8, 'valid%0A'
         16        ECHO                                                     ~9
   15    17      > JMP                                                      ->2
         18    >   FE_FREE                                                  $3
   17    19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.04 ms | 997 KiB | 14 Q