Php regular expression matching function body. Copy the code as follows :? Php $ dataphp_strip_whitespace (test. php); remove comments, spaces, and line breaks (excluding strings) echo $ data; $ datapreg_match_all (func
The code is as follows:
$ Data = php_strip_whitespace ('test. php'); // remove comments, spaces, and line breaks (excluding strings)
Echo $ data;
$ Data = preg_match_all ("
/
Function \ s + # Match function and space
[A-zA-Z _ \ x7f-\ xff] [a-zA-Z0-9 _ \ x7f-\ xff] * # matching function name
\ ([^)] *?) \) \ S + # Match function parameters and capture them as sub-modes
\{
(.*?)
\}(? = (? : \ S * function | \ s *? $) # Matching braces, only when followed by the function or at the end of the string
/Xi
", $ Data, $ matches );
Print_r ($ matches );
?>
The http://www.bkjia.com/PHPjc/320554.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/320554.htmlTechArticle code is as follows :? Php $ data = php_strip_whitespace ('test. php '); // remove comments, spaces, and line breaks (excluding strings) echo $ data; $ data = preg_match_all ("/func...