Reference syntax
Posted: Thu Mar 27, 2003 2:09 pm
I've seen the following tow different syntaxes for passing by reference.
The only difference between the two is that in example 2 the passing variable in the function call does not have an ampersand.
PHP.net examples use syntax like number 2. A lot of tutorials I'm reading and classes I've downloaded use syntax like number 1.
Is the syntax for number 1 being deprecated, or is this just a "You do it one way, I perfer to do it another way" type of thing.
I read on PHP.net that not including the ampersand in the function definition is being deprecated, but that doesn't address either of the two examples above.
Thanks
Code: Select all
// example 1
function foo_func(&$foo)
{
$foo = "baz";
}
$bar = foo_func(&$biz);
// example 2
function foo_func(&$foo)
{
$foo = "baz";
}
$bar = foo_func($biz);PHP.net examples use syntax like number 2. A lot of tutorials I'm reading and classes I've downloaded use syntax like number 1.
Is the syntax for number 1 being deprecated, or is this just a "You do it one way, I perfer to do it another way" type of thing.
I read on PHP.net that not including the ampersand in the function definition is being deprecated, but that doesn't address either of the two examples above.
Thanks