This paper analyses the problem of php5.4 citation times error. Share to everyone for your reference, specific as follows:
php5.3 Series version and previous version, the reference is not a problem, upgrade to php5.4 after, the reference to the place, the full error
Fatal error:call-time pass-by-reference has been removed in F:\work\wamp\www\test\test.php to line 6. take a look at the example below.
Example 1, recursive reference, in PHP 5.3 and the version, test results
<?php
function Test ($aa,& $bb) {
if ($aa < $BB) {
echo $bb. " <br> ";
$BB--;
Test ($aa,& $bb);
}
$AA = 3;
$BB = 6;
Test ($aa,& $bb);
? >
The results of the operation are as follows
6
5
4
PHP 5.4 After the 5.4.11, I was tested with PHP. Newspaper Fatal Error:call-time pass-by-reference has beenremoved in F:\work\wamp\www\test\test.php to line 6.
Example 2,php5.4.11 above test, only test pass reference
<?php
function Test ($aa,& $bb) {
if ($aa < $BB) {
$BB-;
echo $BB. " <br> ";
Test ($aa,& $bb);
}
$AA = 3;
$BB = 6;
Test ($AA, $BB); php5.4,php5.3 and previous versions, the input result is 5
//test ($aa,& $bb);//php5.3 input result is 5,php5.4 and later, error fatal Error:call-time Pass-by-reference .....
?>
After php5.4, you can have an ampersand when you define it, and when you add &, you will get an error. It's weird to call this.
Example 3,php5.4 and recursive reference
<?php
function Test ($aa,& $bb) {
if ($aa < $BB) {
$BB-;
echo $BB. " <br> ";
Test ($AA, $BB);
}
$AA = 3;
$BB = 6;
Test ($AA, $BB);
? >
php5.2,php5.3,php5.4 can run, run results:
5
4
3
Feel this 5.3 liters to 5.4 a bit pit dad, if you do not know the change, the upgrade is very depressed.
More about PHP error and exception related content readers can view the site topics: "PHP error and Exception handling method Summary"
I hope this article will help you with the PHP program design.