我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Php部门不工作[关闭]

For some reason when ever I compile this code, it gives me zero. Why is this?

$aou = 5; //Amount of upvotes
$aod = 2; //Amount of downvotes
$elo = (auo/aod) * 150; //Elo
echo "Your elo is: " . $elo;

The problem is that you type auo and aod instead of $auo and $aod. PHP is trying to look up constants of those names, and not variables.

Constants are defined and used without the dollar sign, e.g.

const FOO = 123;
echo FOO;

But variables need $ every time you use them, thus

$bar = 123;
echo $bar;

近期文章

  • 如何在Zend Framework 2中使用ajax和json编码
  • 如果具有相同的键或值,则不返回数组
  • 使用setInterval()刷新我的php页面的一部分
  • PHP:MySQL选择查询与字符串操作
  • 当我点击space css php时,为什么它会轻松突出整个div? [关闭]
  • (php)mail()是否保存“已发送邮件”?
  • 使用php include时不包含CSS文件
  • !空函数给出了奇怪的价值
  • 为每个表选中复选框
  • 如何使SELECT ... WHERE IN用于AND而不仅仅是OR?
  • 尝试抓住新的例外,这是一个很好的做法吗?
  • MySQL查询选择没有“A”级的学生
  • 在20mb平面文件数据库(PHP)中搜索整个单词的最快方法
  • 使用php调用javascript函数
  • php数组到json数组(使用sendgrid)
  • 如何更改Laravel 5中的默认日志?
  • 用php和bootstrap的Mysql查询进度条
  • Javascript / PHP验证
  • 配置用户和使用PHP连接到Mongo时遇到问题
  • 在php中将字符串转换为整数时返回零

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华