3v4l.org

run code in 300+ 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 = 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/qaJ0S
function name:  (null)
number of ops:  20
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, ->18
          2    > > FE_FETCH_R                                               $4, !1, ->18
    5     3    >   INIT_FCALL                                               'preg_match'
          4        SEND_VAL                                                 '%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'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !2, $5
    6     8        NOP                                                      
          9        FAST_CONCAT                                      ~7      !1, '+is+'
         10      > JMPZ                                                     !2, ->13
         11    >   QM_ASSIGN                                        ~8      'valid'
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~8      'not+valid'
         14    >   CONCAT                                           ~9      ~7, ~8
         15        CONCAT                                           ~10     ~9, '%0A'
         16        ECHO                                                     ~10
    4    17      > JMP                                                      ->2
         18    >   FE_FREE                                                  $4
    7    19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.99 ms | 998 KiB | 14 Q