The examples in this article describe the usage of PHP reference returns. Share it with everyone for your reference, the details are 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
Readers who are interested in more PHP-related content can check out the special topics on this site: "Summary of PHP mathematical operation skills", "Summary of PHP operating office document skills (including word, excel, access, ppt)", "PHP array ( Array) operating skills collection", "php sorting algorithm summary", "php common traversal algorithms and techniques summary", "php data structure and algorithm tutorial", "php programming algorithm summary", "php regular expression usage summary", "Summary of PHP operations and operator usage", "Summary of PHP string usage" and "Summary of common PHP database operation skills"
I hope this article will be helpful to everyone in PHP programming.