Reply to Re: Name of function arguments

Your name:

Reply:


Posted by Rik Wasmus on 01/25/08 14:42

On Fri, 25 Jan 2008 15:08:52 +0100, turnitup <same@same> wrote:

> What's the easiest way to get the name of function arguments?
>
> For example
>
> function fred($day, $week)
> {
> echo (firstargumentname);
> echo (secondargumentname);
>
> }
>
> echoes "day" "week"

<?php
function foo($foo,$bar){
$func =3D new ReflectionFunction(__FUNCTION__);
$params =3D $func->getParameters();
foreach($params as $number =3D> $param){
print("Argument #{$number} is called {$param->name}.\n");
}
}
foo(1,2);
?>

However, this is not really something for production, but rather for =

inspection of 'unknown' code.

-- =

Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация