|
Posted by Yarco on 11/01/06 07:51
Thanks, Alex
AlexVN wrote:
> On Nov 1, 5:41 am, "Yarco" <yarc...@gmail.com> wrote:
> > For example:
> >
> > function test($left, $right)
> > {
> >
> > }$ret = some_php_api('test');
> >
> > print_r($ret);
> >
> > //it would be
> > /*
> > array(
> > 1 => 'left',
> > 2 => 'right',
> > )
> > */
>
> Reflection is your friend.
> function q($a, $b) {
> $result = array();
> $reflection = new ReflectionFunction(__FUNCTION__);
> foreach ($reflection->getParameters() as $param) {
> $result[$param->getName()] = ${$param->getName()};
> }
> return $result;
> }
>
> print_r(q(1, 2));
>
> Sincerely,
> Alexander
> http://www.alexatnet.com/ - PHP/ZendFramework/Ajax blog
Navigation:
[Reply to this message]
|