Home >Backend Development >PHP Tutorial >PHP error message: Call-time pass-by-reference has been deprecated_PHP tutorial

PHP error message: Call-time pass-by-reference has been deprecated_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 10:56:531054browse

Warning suddenly appeared when writing a reference today: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of getimagesize(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer error, I later found out that the reason is that this method has been deprecated and is not available in PHP /Zend is likely to be no longer supported in future versions

Solution

The first method is to change the display_errors = on in php.ini to display_errors = off (do not display errors)

The second method, allow_call_time_pass_reference = Off becomes allow_call_time_pass_reference = On

The above is to modify php.ini, but if you do not have permission to modify the program, let me give a simple example below

Problems may occur

return;
The code is as follows
 代码如下 复制代码

function test1($a,$b){

$b = "fun_test1";

return;

}

$a = "a_value";

$b = "b_value";

test1($a,&$b);

Copy code

function test1($a,$b){

 代码如下 复制代码

function test2($a,&$b){

$b = "fun_test2";

return;

}

$a = "a_value";

$b = "b_value";

test2($a,$b);

$b = "fun_test1";
}

$a = "a_value";$b = "b_value"; test1($a,&$b); No problems will arise
The code is as follows Copy code
function test2($a,&$b){
$b = "fun_test2"; return; } $a = "a_value"; $b = "b_value"; test2($a,$b); http://www.bkjia.com/PHPjc/632128.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632128.htmlTechArticleWarning suddenly appeared when writing a reference today: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declar...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn