Fatal error:call-time pass-by-reference has been removed,passbyreference_php tutorial

Source: Internet
Author: User
Tags deprecated

Fatal error:call-time Pass-by-reference has been removed,passbyreference


The following code error: Fatal error:call-time pass-by-reference has been removed

function MyFunc ($arg) {do something ... }

MyFunc (&$arg); Call myFunc

Or

function MyFunc (&$arg) {do something ... }

MyFunc (&$arg); Call myFunc

Error Analysis:
Allow_call_time_pass_reference Boolean
Whether a warning is issued when a parameter is passed by reference when the function is called. This method has not been approved and is likely to no longer be supported in future versions of Php/zend. The encouraged method is to specify in the function definition which parameters should be passed by reference. Encourage everyone to try turning off this option and making sure that the script works correctly to ensure that the script will run in a future release (each time you use this feature you will receive a warning).

Passing parameters by reference when the function is invoked is not recommended because it affects the cleanliness of the code. If a function's argument is not declared as a reference, the function can modify its parameters through a method that is not written to the document. To avoid side effects, it is best to specify that the parameter is passed by reference only when the function is declared.

Changelog for Allow_call_time_pass_reference Release notes
5.4.0 removed from PHP.
5.3.0 emits an e_deprecated level error.
5.0.0 Deprecated, and generates an e_compile_warning level error.



The reference arguments have been removed from the function call, or the function (& $a) can not be used to invoke functions.
Solution:
Check your php.ini configuration file, adjust the allow_call_time_pass_reference parameter to True, and restart the server to try.

In addition, the previous PHP code may have this error when upgrading to version 5.4 of PHP:

When we use a function (or class) like this, an error is generated:

MyFunc (&$arg); Call myFunc

In fact, this is wrong, but the previous level of error is just deprecated.

The correct use should be when the function is defined:

Function MyFunc (&$arg) {do something ...}

And the direct argument on the call is OK:

MyFunc ($var); Call myFunc




Fatal error:call-time pass-by-reference have been removed in D:\EasyPHP\www\Paixd\DailyAuction\Prcie

This means that the reference argument has been removed at the time of invocation, that is, the function (& $a) cannot be used to pass the parameter call.

Solution:

Check your php.ini configuration file, adjust the allow_call_time_pass_reference parameter to True, and restart the server to try.

======================================
In addition, the previous PHP code may have this error when upgrading to version 5.4 of PHP:

When we use a function (or class) like this, an error is generated:

Foo (& $var);

In fact, this is wrong, but the previous level of error is just deprecated.

The correct use should be when the function is defined:

function foo (& $var) {
Other code
}

And the direct argument on the call is the line: foo ($var);

Bugfree Landing after a line of words

To the number of problematic lines, the & $this and other variables & remove it, and then restart Xampp or bugfree;
or modify the Allow_call_time_pass_reference=on in php.ini.

http://www.bkjia.com/PHPjc/880093.html www.bkjia.com true http://www.bkjia.com/PHPjc/880093.html techarticle Fatal error:call-time Pass-by-reference has been removed,passbyreference the following code error: Fatal error:call-time Pass-by-reference has been removed function MyFunc ($arg) ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.