Match php regular matching function body

WBOY
Release: 2016-07-29 08:40:37
Original
1293 people have browsed it

Copy the code The code is as follows:


$data = php_strip_whitespace('test.php'); //Remove comments, spaces, and newlines (excluding those in the string)
echo $data ;
$data = preg_match_all("
/
functions+ #Match function and the following space
[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]* #Match function name
(([^ )]*?))s+ #Match function parameters and capture them as subpatterns
{
(.*?)
}(?=(?:s*function|s*?$)) #Match curly brackets only if When followed by function or at the end of the string
/xi
", $data, $matches);
print_r($matches);
?>

The above introduces the matching PHP regular matching function body, including matching content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template