PHP运算符如何将变量与其他变量相乘

问题描述

我现在正在学习PHP,并得到了我认为可以完成的任务,但是我得到了

'int(459)'

在网站上打印出来。

这是任务,我试图解决它: 将年龄乘以您的年龄 你去学校,把它的意义 名为total的变量。 然后将总数减去3。 然后检查合计是否大于或等于 到12并将结果放入另一个变量中。 然后使用var_dump查看它是true还是false。


<?php


   $age = 33;
   $schoolyears = 14;
   $total = $age * $schoolyears;

$total -= 3;

$total >= 12;
$newVar = $total;


?>

<!DOCTYPE html>
<html>
  <head>
    
  </head>
  <body>

  <?php
       var_dump($newVar);
   ?>
  </body>
</html>

感谢您的回答! 罗布

更新!

编辑后,它会像这样正常运行。

<?php


   $age = 33;
   $schoolyears = 14;
   $total = $age * $schoolyears;

$total -= 3;

$total = $total >= 12;
$newVar = $total;


?>

<!DOCTYPE html>
<html>
  <head>
    
  </head>
  <body>

  <?php
       var_dump($newVar);
   ?>
  </body>
</html>

它熄灭了:

bool(true)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)