note 105152 added to function.get-defined-functions
| From: | Nguyet dot Duc at osu1 dot php dot net | Date: | Sat, 30 Jul 2011 20:22:09 +0000 |
| Subject: | note 105152 added to function.get-defined-functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182020@lists.php.net to get a copy of this message | ||
get_defined_functions() just returns a list of function names without function arguments. Here is
the code to list user-defined function names plus arguments:
<?php
$content = file_get_contents('example.php');
preg_match_all("/(function )(\S*\(\S*\))/", $content, $matches);
foreach($matches[2] as $match) {
$function[] = "// " . trim($match) . "<br />\n";
}
natcasesort($function);
$functionlist .= "/* Functions in this file */<br />\n";
$functionlist .= "/**************************/<br />\n\n";
$functionlist .= implode('', $function);
echo $functionlist;
?>
Output:
/* Functions in this file */
/**************************/
// add_data($data)
// add_files($list)
// archive($name)
// bzip_file($name)
----
Server IP: 69.147.83.197
Probable Submitter: 171.229.54.35
----
Manual Page -- http://www.php.net/manual/en/function.get-defined-functions.php
Edit -- https://master.php.net/note/edit/105152
Del: integrated -- https://master.php.net/note/delete/105152/integrated
Del: useless -- https://master.php.net/note/delete/105152/useless
Del: bad code -- https://master.php.net/note/delete/105152/bad+code
Del: spam -- https://master.php.net/note/delete/105152/spam
Del: non-english -- https://master.php.net/note/delete/105152/non-english
Del: in docs -- https://master.php.net/note/delete/105152/in+docs
Del: other reasons-- https://master.php.net/note/delete/105152
Reject -- https://master.php.net/note/reject/105152
Search -- https://master.php.net/manage/user-notes.php