求解:值传递与引用传递中&如何定义与应用
程序:
<html>
<head>
<title>值传递与引用传递</title>
</head>
<body>
<?php
function swap($Var1,$Var2)
{
$VarTemp=$Var1;
$Var1=$Var2;
$Var2=$Vartemp;
}
$int1=1;
$int2=2;
swap($int1,$int2);
echo "\$int1=$int1,\$int2=$int2<br>";
$int3=1;
$int4=2;
swap(&$int3,&$int4);
echo "\$int3=$int3,\$iNt4=$int4<br>";
?>
</body>
</html>
错误:
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of swap(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in c:\appserv\www\include\p\p4-3.php on line 19
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of swap(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in c:\appserv\www\include\p\p4-3.php on line 19
$int1=1,$int2=2
$int3=2,$int4=
请问各位大虾如何解决问题,我是一个刚刚学习PHP的新手.
请问&如何在PHP.INI中定义才能使用.
问题点数:20、回复次数:1Top
1 楼gu1dai(异域苍穹.百年飞行)回复于 2006-03-07 09:07:13 得分 20
function swap(&$Var1,&$Var2)
{
$VarTemp=$Var1;
$Var1=$Var2;
$Var2=$Vartemp;
}
$int3=1;
$int4=2;
swap($int3,$int4);
echo "\$int3=$int3,\$iNt4=$int4<br>";Top




