<bdo id='vfgX5'></bdo><ul id='vfgX5'></ul>
  • <tfoot id='vfgX5'></tfoot>

    <small id='vfgX5'></small><noframes id='vfgX5'>

    <legend id='vfgX5'><style id='vfgX5'><dir id='vfgX5'><q id='vfgX5'></q></dir></style></legend>
    <i id='vfgX5'><tr id='vfgX5'><dt id='vfgX5'><q id='vfgX5'><span id='vfgX5'><b id='vfgX5'><form id='vfgX5'><ins id='vfgX5'></ins><ul id='vfgX5'></ul><sub id='vfgX5'></sub></form><legend id='vfgX5'></legend><bdo id='vfgX5'><pre id='vfgX5'><center id='vfgX5'></center></pre></bdo></b><th id='vfgX5'></th></span></q></dt></tr></i><div id='vfgX5'><tfoot id='vfgX5'></tfoot><dl id='vfgX5'><fieldset id='vfgX5'></fieldset></dl></div>
      1. 为什么在 PHP 中 true 大于 3

        Why is true greater than 3 in PHP(为什么在 PHP 中 true 大于 3)

          <small id='7qhZk'></small><noframes id='7qhZk'>

            <tfoot id='7qhZk'></tfoot>
                <tbody id='7qhZk'></tbody>

            • <i id='7qhZk'><tr id='7qhZk'><dt id='7qhZk'><q id='7qhZk'><span id='7qhZk'><b id='7qhZk'><form id='7qhZk'><ins id='7qhZk'></ins><ul id='7qhZk'></ul><sub id='7qhZk'></sub></form><legend id='7qhZk'></legend><bdo id='7qhZk'><pre id='7qhZk'><center id='7qhZk'></center></pre></bdo></b><th id='7qhZk'></th></span></q></dt></tr></i><div id='7qhZk'><tfoot id='7qhZk'></tfoot><dl id='7qhZk'><fieldset id='7qhZk'></fieldset></dl></div>
                <bdo id='7qhZk'></bdo><ul id='7qhZk'></ul>
                  <legend id='7qhZk'><style id='7qhZk'><dir id='7qhZk'><q id='7qhZk'></q></dir></style></legend>
                • 本文介绍了为什么在 PHP 中 true 大于 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想知道为什么 PHP 中的以下语句返回 true?

                  I am wondering why following statement in PHP is returning true?

                  true>=4
                  

                  例如这样的行会回显 1

                  echo true>=4;
                  

                  谁能解释一下这背后的逻辑?

                  Can anyone explain me the logic behind this?

                  推荐答案

                  除了 Davids 的回答之外,我还想添加一些东西来增加深度.

                  In addition to Davids answer, I thought to add something to give a little more depth.

                  PHP 与其他编程语言不同,如果您不小心操作符/语法,您可能会陷入像您遇到的那种棘手的坑洞.

                  PHP unlike other programming languages, if your not careful with your operators/syntax you can fall into tricky pot holes like the one you experience.

                  正如大卫所说,

                  4 也是真(因为它非零),真等于真,所以它也大于或等于 true.

                  4 is also true (because it's non-zero), and true is equal to true, so it's also greater than or equal to true.

                  考虑到这一点真大于假.

                  真 = 1

                  假=0

                  举个例子:

                  $test = 1;
                  if ($test == true){
                  echo "This is true"; 
                  }else{
                  echo "This is false";
                  }
                  

                  上面会输出

                  这是真的

                  但是如果你接受这个:

                  $test = 1;
                  if ($test === true){
                  echo "This is true"; 
                  }else{
                  echo "This is false";
                  }
                  

                  上面会输出:

                  这是假的

                  添加的等号查找完全匹配,从而查找 integer 1 而不是 PHP 读取 1 为真.

                  The added equals sign, looks for an exact match, thus looking for the integer 1 instead of PHP reading 1 as true.

                  我知道这有点离题,但只是想解释一下 PHP 包含的一些坑.

                  希望对您有所帮助

                  回答你的问题:

                  回声真>=4;

                  您看到 1 作为输出的原因是因为 true/false 被解释为数字(见上文)

                  Reason you are seeing 1 as output, is because true/false is interpreted as numbers (see above)

                  无论你是在做 echo true>=4 还是只是 echo true; php 都将 true 设为 1,将 false 设为 0

                  Regardless if your doing echo true>=4 or just echo true; php puts true as 1 and false as 0

                  这篇关于为什么在 PHP 中 true 大于 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <i id='wOHtM'><tr id='wOHtM'><dt id='wOHtM'><q id='wOHtM'><span id='wOHtM'><b id='wOHtM'><form id='wOHtM'><ins id='wOHtM'></ins><ul id='wOHtM'></ul><sub id='wOHtM'></sub></form><legend id='wOHtM'></legend><bdo id='wOHtM'><pre id='wOHtM'><center id='wOHtM'></center></pre></bdo></b><th id='wOHtM'></th></span></q></dt></tr></i><div id='wOHtM'><tfoot id='wOHtM'></tfoot><dl id='wOHtM'><fieldset id='wOHtM'></fieldset></dl></div>

                      <bdo id='wOHtM'></bdo><ul id='wOHtM'></ul>

                      <tfoot id='wOHtM'></tfoot>

                            <tbody id='wOHtM'></tbody>
                          • <legend id='wOHtM'><style id='wOHtM'><dir id='wOHtM'><q id='wOHtM'></q></dir></style></legend>

                            <small id='wOHtM'></small><noframes id='wOHtM'>