Reply to Re: [PHP] functions that take variable arguments?

Your name:

Reply:


Posted by Richard Heyes on 12/05/05 12:54

Eternity Records Webmaster wrote:
> how do you create/use a function that takes an undefined amount of
> arguments? I looked at the manual but its a little confusing. for example, i
> want to make a function called Update inside a DB class:
>
> class DB {
> //vars here
> var $host;
> var $DbUser;
>
> //functions
> function Update(...) {
> //this function can take as few as 1 argument or as many as php will allow
> //its supposed to update a database with the new values of the arguments.
> //any help getting started on creating a function like this would be
> apreciated
> }
> //end class
> }


class DB
{
function Update()
{
$args = func_get_args();
}
}

$args will then be a regular array of any/all the arguments passed to
the function.

--
Richard Heyes
http://www.phpguru.org/

[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

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