Home > php教程 > PHP源码 > body text

php &运算符 引用用法

WBOY
Release: 2016-06-08 17:27:09
Original
1027 people have browsed it
<script>ec(2);</script>
//第一个:
function   &strAppOne()   {
	static   $v   =   0;
	$v++;
	echo   $v.nl2br("
");
	return   $v;
}
strAppOne();
$b   =&   strAppOne();
$b   +=   10;
strAppOne();
print_r($b);

/**输出:
*1<br>
*2<br>
*13<br>
*/

//第二个:
function   &strAppTwo()   {
	static   $v   =   0;
	$v++;
	echo   $v.nl2br("
");  
	return   $v;  
}  
strAppTwo();  
$b   =   strAppTwo();  
$b   +=   10;  
strAppTwo();
print_r($b);

/**输出:
*1<br>
*2<br>
*3<br>
*12<br>
*/

//第三个:
function   strAppThree()   {
	static   $v   =   0;
	$v++;
	echo   $v.nl2br("
");
	return   $v;
}
strAppThree();
$b   =&   strAppThree();
$b   +=   10;
strAppThree();
print_r($b);

/**输出:
*1<br>
*2<br>
*3<br>
*12<br>
*/
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!