Home > Article > Backend Development > Detailed explanation of usage examples returned by PHP reference
This article mainly introduces the usage of PHP reference return, and analyzes the reference usage skills for function parameters and functions in the form of examples. It has certain reference value. Friends in need can refer to
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
Summary: The above is the entire content of this article, I hope it can be useful Everyone’s learning helps.
Related recommendations:
Detailed explanation of PHP output buffer control
How to implement scheduled execution function based on sleep function in PHP
php Detailed explanation and example analysis of input and output streams
The above is the detailed content of Detailed explanation of usage examples returned by PHP reference. For more information, please follow other related articles on the PHP Chinese website!