简单的PHP ..不工作......嗯看起来很简单

0 html javascript css php xhtml

请检查以下代码:

<?php
   $d=2;
   echo "the sum of the number is"."<sub>($d+1)</sub>";
?>
Run Code Online (Sandbox Code Playgroud)

它作为输出给出:

the sum of the number is <sub>(2+1)</sub>

理想情况下,我需要输出"the sum of the number is <sub>3</sub>".当我们不使用HTML标签时,它工作正常<sub>...

我怎样才能解决这个问题?

Anu*_*san 6

试着把它写成

<?php $d=2; echo "the sum of the number is"."<sub>".($d+1)."</sub>"; ?>
Run Code Online (Sandbox Code Playgroud)

引号给它一个字符串表示,因此不允许你执行添加.