The following example:
$age = 10;function Grow ($age) { $age + = 1; return $age;} Echo Grow (& $age), ' <br/> '; 11echo $age, ' <br/> '; 11
In the previous example, the global variable was also affected after the function was called.
Because we do "reference", this way, contrary to the concept of "encapsulation", affecting the cleanliness of the code.
Therefore, it is not recommended to do so.
In Php5.3,php.ini, there is an option, as follows
Allow_call_time_pass_reference = Off
If off, the function references the Warning:call-time pass-by-reference has been deprecated if on, does not report warning
in PHP5.4 , the function reference is completely abolished, and when a function is used to reference the parameter,
reported fatal error: Call-time pass-by-reference has been removed
Workaround:
1:allow_call_time_pass_reference = On But this is not a fundamental solution, if porting 5.4, or not.
2: Modify your own code, do not reference the function of the argument.
Function:
Recursive escape Array function _addslashes ($arr) { foreach ($arr as $k = = $v) { if (is_string ($v)) { $arr [$k] = Addslashes ($v); } else if (Is_array ($v)) { //plus judgment, if it is an array, call itself, then go $arr [$k] = _addslashes ($v);} } return $arr;}
Error reporting with reference to parameters and recursive escape