3v4l.org

run code in 500+ PHP versions simultaneously
<?php $names = array('Mike Cannon-Brookes', "Bill O'Hara-Jones", "Jane O'-Reilly", "Mary Smythe-'Fawkes"); foreach ($names as $name) { $name_valid = preg_match("/^(?!.*['-]{2})[a-zA-Z][a-zA-Z'\s-]{1,20}$/", $name); echo "$name is " . (($name_valid) ? "valid" : "not 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/qaJ0S
function name:  (null)
number of ops:  17
compiled vars:  !0 = $names, !1 = $name, !2 = $name_valid
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1      > FE_RESET_R                                           $4      !0, ->15
          2    > > FE_FETCH_R                                                   $4, !1, ->15
    5     3    >   FRAMELESS_ICALL_2                preg_match          ~5      '%2F%5E%28%3F%21.%2A%5B%27-%5D%7B2%7D%29%5Ba-zA-Z%5D%5Ba-zA-Z%27%5Cs-%5D%7B1%2C20%7D%24%2F', !1
          4        ASSIGN                                                       !2, ~5
    6     5        NOP                                                          
          6        FAST_CONCAT                                          ~7      !1, '+is+'
          7      > JMPZ                                                         !2, ->10
          8    >   QM_ASSIGN                                            ~8      'valid'
          9      > JMP                                                          ->11
         10    >   QM_ASSIGN                                            ~8      'not+valid'
         11    >   CONCAT                                               ~9      ~7, ~8
         12        CONCAT                                               ~10     ~9, '%0A'
         13        ECHO                                                         ~10
    4    14      > JMP                                                          ->2
         15    >   FE_FREE                                                      $4
    7    16      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.52 ms | 2309 KiB | 13 Q