The examples in this article describe the use of PHP reference returns. Share to everyone for your reference, specific as follows:
Example 1:
<?php
$a = 1;
Function B (& $c)
{
$c + +;
return $c;
}
$d =b ($a);
$d + +;
Echo ($a);
? >
Output: 2
Example 2:
<?php
$a = 1;
Function &b (& $c)
{
$c + +;
return $c;
}
$d =&b ($a);
$d + +;
Echo ($a);
? >
Output: 3
More interested in PHP related content readers can view the site topics: "PHP Math Arithmetic Skills summary", "PHP operation Office Document Skills Summary (including word,excel,access,ppt)", "PHP Array" operation Skills Encyclopedia, " Summary of the PHP sorting algorithm, "PHP commonly used traversal algorithm and skills summary", "PHP Data structure and algorithm tutorial", "PHP Programming Algorithm Summary", "PHP Regular Expression Usage summary", "PHP operation and operator Usage Summary", "PHP string (String) Usage summary" and " A summary of common PHP database operations tips
I hope this article will help you with the PHP program design.