$a = 'wap';
$b ='kkk';
<code>function sum($p) { return $p.='aaa'; } function &sum2($p) { return $p.='bbb'; } echo sum($a); echo "<br/>"; echo sum2($b); </code>
$a = 'wap';
$b ='kkk';
<code>function sum($p) { return $p.='aaa'; } function &sum2($p) { return $p.='bbb'; } echo sum($a); echo "<br/>"; echo sum2($b); </code>
我已经在你的另一个问题中回答了你的相关提问,在此例中,如果想进行比较,你可以将代码修改为:
<code>$a = 'wap'; $b ='kkk'; function sum($p) { return $p.='aaa'; } function &sum2(&$p) { return $p.='bbb'; }//既然是返回引用,自然不能使用形参传递,所以将$p改为&$p echo sum($a);//output is wapaaa echo "<br/>"; echo sum2($b);//output is kkkbbb echo "<br/>"; echo sum($a);//output is wapaaa echo "<br/>"; echo sum2($b);//output is kkkbbbbbb </code>