Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^(( * * *(public|private|protected) +function)|( * * *function)) +[a-zA-Z_][a-zA-Z0-9_-]* *(\(( *(([a-zA-Z_][a-zA-Z0-9_-]* +)?(\.\.\.)?\$[a-zA-Z_][a-zA-Z0-9_-]*( *= *[^\),]+(\([^\)]*\))?)?)( *, *([a-zA-Z_][a-zA-Z0-9_-]* +)?(\.\.\.)?\$[a-zA-Z_][a-zA-Z0-9_-]*( *= *[^\),]+(\([^\)]*\))?)?)*)? *\) *(: *[a-zA-Z_][a-zA-Z0-9_-]*)?)$
/

Description

Test the prototype of a PHP fuction (even PHP7) protected function f1(int ...$test): string is true, function f2 ( array $test2 = array(), $test3) is true...

Submitted by Smiley32 - 8 years ago