PHP Fatal error:cannot pass parameter 2 by reference in
This error means that the 2nd argument cannot be passed as a reference
My understanding is that the 2nd parameter of the method needs to pass a variable
Local PHP is 5.4.35
The situation I have appeared is as follows:
1<?PHP2 3 functionTest$param 1,&$param 2){4 $param 2++;5 }6 7 //this way the call will show Fatal error:only variables can be passed by reference in/var/www/html/test.php on line 98 //Because the second parameter is not a variable9 //test (a);Ten One //In the case of no modification of the method A //The correct method is to store the value of the second parameter in a variable, such as - $param 3= 1; -Test (1,$param 3); the //now the value of $PARAM3 is 2.
The essay references:
Reference delivery
"PHP error" cannot pass parameter 2 by reference
Fatal Error:cannot pass parameter 2 by reference
PHP Fatal error:cannot pass parameter 2 by reference