search
Homephp教程php手册解决Fatal error: Call-time pass-by-reference has bee

今天在使用PHP 5.4.15 版本时遇到这个错误: Fatal error : Call-time pass-by-reference has been removed in /opt/lampstack-5.4.15-0/apps/lixiphp/htdocs/function.inc on line 161 产生这个错误原因是在PHP函数语句中使用来引用变量。比如: foo($varia

今天在使用PHP 5.4.15 版本时遇到这个错误:

Fatal error: Call-time pass-by-reference has been removed in /opt/lampstack-5.4.15-0/apps/lixiphp/htdocs/function.inc on line 161

产生这个错误原因是在PHP函数语句中使用&来引用变量。比如:

foo(&$variable);

实际上,这样用法在PHP 5.3 中就会有提示,只是之前的仅仅会提示Deprecated而已。

简单一句话,调用函数时不需要传递引用变量。

正确用法

函数语句中不需要使用引用变量。
myFunc($var);//Call myFunc
function myFunc(&$arg) { do something... }???? 

错误用法

myFunc(&$arg);//Call myFunc 
function myFunc($arg) { do something... }? 

屏蔽错误显示

error_reporting(0); 
ini_set('display_errors', 'off');

运行时环境:

php-5.4.15 使用PHP 5.4.15 版本

(...)
Read the rest of 解决Fatal error: Call-time pass-by-reference has been removed (9 words)


© lixiphp for LixiPHP, 2013. | Permalink | No comment | Add to del.icio.us
Post tags: PHP 5.4, reference. 引用

Feed enhanced by Better Feed from Ozh

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use