PHP函数可以使用引用类型的参数,类似于C语言里的指针
/**
* PHP给函数使用引用参数的代码演示
*
* @param
* @arrange 512-笔记网: www.512Pic.com
**/
<html>
<head>
<title>Passing Argument by Reference</title>
</head>
<body>
<?PHP
function addFive($num)
{
$num += 5;
}
function addSix(&$num)
{
$num += 6;
}
$orignum = 10;
addFive( &$orignum );
echo "Original Value is $orignum<br />";
addSix( $orignum );
echo "Original Value is $orignum<br />";
?>
</body>
</html>
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
输出结果如下Original Value is 15 Original Value is 21