php 函数参数 引用,php 函数参数的引用
error_reporting(E_ALL);
sweep ($ignore, $ignore);
// no errors occur here
sweep($a=1,$b=1);
/**
程序設計處理,
1 在使用了引用的參數,傳遞一個為null的參數, 在函數內部如果重新給參數賦值, 則以內部賦值結果為準
2 如果參數被定義為引用, 在函數內部如果有重新賦值, 則在此程序后, 被使用的參數,都會永久變更為函數內賦值的新值.
3 在開啟了捕獲所有錯誤信息的開關后, 如果對引用參數,傳遞了臨時變量, 則會出現錯誤.
**/
function sweep ( &$filecount, &$bytecount ) {
var_dump($filecount,$bytecount);
$filecount = 1;
$bytecount = 1024;
print "Files: $filecount - Size: $bytecount";
// prints "Files: 1024 - Size: 1024"
}
// output
---------- php ----------
NULL
NULL
Files: 1024 - Size: 1024
Strict Standards: Only variables should be passed by reference in D:\phpStudy\WWW\demo\fun_argc_refresh.php on line 6
Strict Standards: Only variables should be passed by reference in D:\phpStudy\WWW\demo\fun_argc_refresh.php on line 6
int(1)
int(1)
Files: 1 - Size: 1024PHP Strict Standards: Only variables should be passed by reference in D:\phpStudy\WWW\demo\fun_argc_refresh.php on line 6
PHP Strict Standards: Only variables should be passed by reference in D:\phpStudy\WWW\demo\fun_argc_refresh.php on line 6
Output completed (0 sec consumed) - Normal Termination
總結
以上是生活随笔為你收集整理的php 函数参数 引用,php 函数参数的引用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php post处理,PHP处理GETP
- 下一篇: php运行资源库,如何在sublime上