只使用加号运算符

时间:2012-10-26 07:16:00

标签: php

如果变量1,2和3分别具有值3,5和7, 选择将导致放置值的正确方程序列 变量1中的12 和 变量3中的15 (仅使用ADD运算符)

    $var1 = 3;
$var2 = 5;
$var3 = 7;

//anser 12 
echo $var1 = $var2 + $var3;


echo $var3 = $var3 + $var1;
//here i need to ge 15 for var 3 
//but var1 value now 12 so anser is 19 (wrong)

1 个答案:

答案 0 :(得分:1)

$var1 = 3;
$var2 = 5;
$var3 = 7;


$var2 = $var3+$var2; # 12
$var3 = $var2+$var1; # 15
$var1 = $var2; # 12