Maison > Article > développement back-end > function 里面如何定义ref 输出的参数
function 里面怎么定义ref 输出的参数?
类似asp那种的,
<br />function fo($a,$b,$cheng,$jia)<br />{<br /> $cheng = $a*$b;<br /> $jia = $a + $b;<br />}<br />
function fo($a, $b, &$cheng, &$jia)<br />{<br /> $cheng = $a*$b;<br /> $jia = $a + $b;<br />}
<br />function fo($a,$b,&$cheng,&$jia)<br />{<br /> $cheng = $a*$b;<br /> $jia = $a + $b;<br />}<br /><br />fo(1,2,$cheng, $jia);<br /><br />echo $cheng; // 2<br />echo $jia; // 3<br />