Calling functions by reference
| From: | cjsmith at btinternet dot com | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Calling functions by reference | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18424@lists.php.net to get a copy of this message | ||
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)
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.