Re: [PHP4BETA] Varargs user function?

From: Date: Mon, 20 Sep 1999 16:03:34 +0000
Subject: Re: [PHP4BETA] Varargs user function?
References: 1 2  Groups: php.version4 
Request: Send a blank email to php-version4+get-4684@lists.php.net to get a copy of this message
Hi, why not to use function blah($first, $second, $more) { ... } and call it like: blah("one", "two", array("three", "four", "five")); ? Jkuba 20.09.1999 v 14:01:41 (+0200), Kristian Köhntopp napsal: > > Zeev Suraski wrote: > > > How do I write a varargs user function in Zend/PHP4? > > > > > > In PHP3, I have the choice to cap the maximal number of parameters and use > > > default arguments, or to pass an array to the function. Has this changed/improved > > > in Zend/PHP4? > > > > No, it hasn't. The syntax is identical. > > I suppose there is no way that we get a more elegant way to write varargs > functions in Zend/PHP4? Perhaps by declaring them in a special way > > function blah(varargs $a) { > /* access $a as an array */ > } > > /* Call them as a function with a variable number of > * args that is automatically transformed into an > * array within the function? > * > */ > > blah($c, $d, 1, 2, 3); > blah($x, $z, $q); > > or by some other kind of magic? > > -- > Kristian Köhntopp, NetUSE Kommunikationstechnologie GmbH > Siemenswall, D-24107 Kiel, Germany, +49 431 386 436 00 > Using PHP3? See our web development library at > http://phplib.netuse.de/ (We have moved! Update your > bookmarks!) > > -- > PHP 4 Beta -- Jakub "RiffRaff" Skopal mailto:j@kubs.cz

« previous php.version4 (#4684) next »