Pass-by-reference with default?
Unfortunately, in PHP, you don't appear to be able to use default argument values when passing by reference, so you can't make pass-by-reference arguments optional.
eg, you can write:
function secondargoptional($something,$otherthing= 'default') { ... }
or
function secondargbyreference($something,&$otherthing) { ... }
but not
function secondargopptionalbyreference($something, &$otherthing=NULL ) { ... }
which would allow me to append the reference parameter only when I actually need it.
(In PHP 4.3.4 at least)
Anyone got a workaround, or care to prove me wrong?
eg, you can write:
function secondargoptional($something,$otherthing=
or
function secondargbyreference($something,&$otherthing) { ... }
but not
function secondargopptionalbyreference($something,
which would allow me to append the reference parameter only when I actually need it.
(In PHP 4.3.4 at least)
Anyone got a workaround, or care to prove me wrong?
