note 41778 deleted from function.preg-match-all by colder
| From: | colder@php.net | Date: | Mon, 16 Apr 2007 16:53:16 +0000 |
| Subject: | note 41778 deleted from function.preg-match-all by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125453@lists.php.net to get a copy of this message | ||
Note Submitter: vb_user at yahoo dot com
----
If you want to extract the list of php functions in one of your library (ie, includes) for
documentation or any purpose use the below:
$filename = 'library.php';
$fp = fopen($filename,'r');
if ($fp !== false) {
$str = fread($fp, filesize ($filename));
$count = preg_match_all ("|function[ ]+(.*)[\(](.*)[\)]|U", $str, $out,
PREG_PATTERN_ORDER);
for ($i=0; $i<$count; $i++) {
if (!eregi('array',$out[1][$i])) {
echo '#T='.$out[1][$i]."\n";
echo $out[1][$i].'('.$out[2][$i].')'."\n\n";
}
}
}