[nycphp-talk] passing optional arguments by reference
Daniel Convissor
danielc at analysisandsolutions.com
Fri Jan 16 11:34:22 EST 2004
Hi Folks:
I'm want the parameters for a function to be passed by reference.
Normally, that's accomplished by placing a & in front of the variable.
Trick is, the argument in question needs to be optional. Placing a & in
front of an optional parameter creates a parse error.
CODE:
function &execute($stmt, &$data = array()) {
}
ERROR:
Parse error: parse error, unexpected '=', expecting ')'
Removing the "= array()" makes it parse fine.
So, is there a way to do this, please?
Thanks,
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programming
http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409
More information about the talk
mailing list