dsh12544 2016-02-23 23:00
浏览 42

PHP致命错误:函数名称必须是第14行的字符串[关闭]

Hi Im trying to do this simple code within a loop that does the following: Program to write: Write a program to do the algebraic equation x = a(b+6)/2 multiple times within loops that vary a and b. The variable a should start at 1 go to 10 and increment by 1. The variable b should start at 2 and go to 10 and increment by 2. When you display the answer show the formula in php. I want you to do this three times: once with a for...next, once with a do...while and once with a while. I think my logic is right but Im getting the error and I cant debug.

<html>
<head><title>DO WHILE</title></head>
<body>
<h2>Do While</h2>
<?php

$VarA = 1;
$VarB = 2;
$VarC = 6;
$VarD = 2;
$ctA = 1;
$ctB = 2;
$VarAns = 0;
$VarAns = ($VarA ($VarB+$VarC6) / $VarD);
do 
{
$VarAns = ($VarA ($VarB+$VarC6) / $VarD);
print ("x = $VarA($VarB+6)/2 is equal to VarX<br>");
$ctA = $ctA + 1;
$ctB = $ctB + 2;
} while ($ctA <= 10 and $ctB <=10);
?>
</body>
</html>
  • 写回答

1条回答 默认 最新

  • dpd46554 2016-02-23 23:06
    关注

    On your line 14 as the title says, you have this

    $VarAns = ($VarA ($VarB+$VarC6) / $VarD);
    

    This doesnt work with PHP...

    Instead write it more clearly like

    $VarAns = $VarA * ($VarB+$VarC6) / $VarD;
    

    Same thing applies to other part of your code where you use brackets like that.

    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制