有人可以告诉我为什么我的PHP行不能正常工作(回声)?
我知道我可以用不同的方式编写代码来使换行工作,但我想知道这背后的原因?
<?PHP
$var1 = 3;
echo "Addition = " . $var1 += 3 . "<br>";
echo "Subtraction = " . $var1 -= 3 . "<br>";
echo "Multiplication = " . $var1 *= 3 . "<br>";
echo "Division = " . $var1 /= 3 . "<br>";
?>
解决方法:
你可以使用逗号,
echo "Addition = " . $var1 += 3 , "<br>";
echo "Subtraction = " . $var1 -= 3 ,"<br>";
echo "Addition = " . $var1 *= 3 , "<br>";
echo "Addition = " . $var1 /= 3 ,"<br>";
或者用括号括起来:
echo "Addition = " . ($var1 += 3) . "<br>";
echo "Subtraction = " . ($var1 -= 3) ."<br>";
echo "Addition = " . ($var1 *= 3) . "<br>";
echo "Addition = " . ($var1 /= 3) ."<br>";
否则,3号码与< br>连接.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。