php – 为什么html br break行标记在这段代码中不起作用?
作者:互联网
有人可以告诉我为什么我的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>连接.
标签:html,php,operator-precedence 来源: https://codeday.me/bug/20191007/1867323.html