In my previous article: SHOPNC Mall Source Reading notes-The opening overview, encountered a PHP reference value caused by the error, the situation is as follows:
When I check the English version of the official PHP document http://php.net/manual/zh/language.references.pass.php
See the following description:
Note that there is no reference symbol in the function call-only in the function definition. The function definition alone is enough to make the argument pass through the reference correctly. In the most recent version of PHP, if you use & in foo (& $a) , you will get a warning that "call-time pass-by-reference" is obsolete.
Then switch to the English version of the document to get the following description:
Note: There is no reference sign on a function call-only on function definitions. Function definitions alone is enough to correctly pass the argument by reference. As of PHP 5.3.0, you'll get a warning saying that "call-time pass-by-reference" was deprecated when you use & in Foo (& $a);. And as of PHP 5.4.0, Call-time pass-by-reference is removed, so using it would raise a fatal error.
The
pit Si person does not have the die to have the wood to have!
A gently, gentle to tell you, it's OK, not very painful, all of a sudden, let you useful @ shielding the impulse of warning
It's actually going to hurt you so much that you can't go on at all.
So there's nothing to this question why, very clear
The function definition alone is sufficient for the parameter to be passed correctly by reference, as
function test (&var) {
}
You do not have to pass the reference when you call test, such as test (&var); Otherwise the fatal error will be reported, the same as not write a semicolon, there is no why!
Also gain a valuable experience: later in the official documents, do not read the Chinese version.
If the English is not good, you can collect the relevant blog post, see others summed up the knowledge is better than looking at the official Chinese documents.
PHP Reference Transfer specification problem