Re: Calling functions by reference
| From: | Wico de Leeuw | Date: | Tue, 03 Oct 2000 16:06:36 +0000 |
| Subject: | Re: Calling functions by reference | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-18439@lists.php.net to get a copy of this message | ||
At 15:45 3-10-00 +0000, cjsmith@btinternet.com wrote:
Hi, I am trying to write a function that has parameters passed by reference, and was wondering how to get a default value to them. e.g.: function test(&$a, &$b = 0)$a = "plop"; $b = 1; test(&$a, &$b); ... function test($a, $b = 0) { }
doesn't work (PHP complains about expecting a ')' after the second parameter). Is there some other syntactically-valid way to achieve this, or do I have to provide *all* variables when I call this function? (This is a pain, as you can't statically assign values at the other end either - you have to define a temporary variable with no content). Thanks in advance, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net