note 105367 added to class.reflectionfunction
| From: | LorenzR dot S dot at osu1 dot php dot net | Date: | Fri, 12 Aug 2011 08:24:03 +0000 |
| Subject: | note 105367 added to class.reflectionfunction | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182439@lists.php.net to get a copy of this message | ||
Here is a concise example of ReflectionFunction usage for Parameter Reflection / introspection (e.g.
to automatically generate API descriptions)
<?php
$properties = $reflector->getProperties();
$refFunc = new ReflectionFunction('preg_replace');
foreach( $refFunc->getParameters() as $param ){
//invokes â ReflectionParameter::__toString
print $param;
}
?>
prints:
Parameter #0 [ <required> $regex ]
Parameter #1 [ <required> $replace ]
Parameter #2 [ <required> $subject ]
Parameter #3 [ <optional> $limit ]
Parameter #4 [ <optional> &$count ]
----
Server IP: 69.147.83.197
Probable Submitter: 80.239.242.94 (proxied: 77.118.252.95)
----
Manual Page -- http://www.php.net/manual/en/class.reflectionfunction.php
Edit -- https://master.php.net/note/edit/105367
Del: integrated -- https://master.php.net/note/delete/105367/integrated
Del: useless -- https://master.php.net/note/delete/105367/useless
Del: bad code -- https://master.php.net/note/delete/105367/bad+code
Del: spam -- https://master.php.net/note/delete/105367/spam
Del: non-english -- https://master.php.net/note/delete/105367/non-english
Del: in docs -- https://master.php.net/note/delete/105367/in+docs
Del: other reasons-- https://master.php.net/note/delete/105367
Reject -- https://master.php.net/note/reject/105367
Search -- https://master.php.net/manage/user-notes.php