note 100517 deleted from reflectionmethod.invokeargs by danbrown
| From: | danbrown@php.net | Date: | Thu, 21 Oct 2010 02:47:11 +0000 |
| Subject: | note 100517 deleted from reflectionmethod.invokeargs by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173328@lists.php.net to get a copy of this message | ||
Note Submitter: contato at andersonfraga dot net
Reason: useless
----
InvokeArgs doesn't accept named parameters with your keys:
<?php
class Test {
public function methodHere($arg1, $arg2, $arg3) {
echo '<pre>';
echo $arg1 . PHP_EOL;
echo $arg2 . PHP_EOL;
echo $arg3 . PHP_EOL;
echo '</pre>';
}
}
$ref_test = new ReflectionClass('Test');
$ref_method = $ref_test->getMethod('methodHere');
$list_args = Array(
'arg2' => 'apple',
'arg1' => 'wine',
'arg4' => 'arch enemy', // what? arg4??
);
$ref_method->invokeArgs(new Test(), $list_args);
/**
print:
apple
wine
thats all folks!
*/
?>
This is not good...