|
Posted by ImOk on 05/16/06 07:29
I tried the test according to the docs. It seems the method of
ReflectionFunction->getParameters() does not work for internal
functions although it detects the parameters. Any ideas? Is this a bug
or am i doing something wrong?
<?php
print phpversion(); // 5.1.4
function baz(ReflectionFunction $a, $b = 1, $c = null) { }
// Create an instance of Reflection_Function with the
// parameter given from the command line.
$reflect = new ReflectionFunction("baz"); // works for this one.
//$reflect = new ReflectionFunction("strncmp"); // e.g. does not work
for this function
echo $reflect;
foreach ($reflect->getParameters() as $i => $param) {
printf(
"-- Parameter #%d: %s {\n".
" Class: %s\n".
" Allows NULL: %s\n".
" Passed to by reference: %s\n".
" Is optional?: %s\n".
"}\n",
$i,
$param->getName(),
var_export($param->getClass(), 1),
var_export($param->allowsNull(), 1),
var_export($param->isPassedByReference(), 1),
$param->isOptional() ? 'yes' : 'no'
);
}
?>
Navigation:
[Reply to this message]
|