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

  • <small id='coF5q'></small><noframes id='coF5q'>

      <bdo id='coF5q'></bdo><ul id='coF5q'></ul>
    1. <tfoot id='coF5q'></tfoot>
      <legend id='coF5q'><style id='coF5q'><dir id='coF5q'><q id='coF5q'></q></dir></style></legend>

      1. PHP - if 语句中的倒序

        PHP - reversed order in if statement(PHP - if 语句中的倒序)

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

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

            • <bdo id='mdKu5'></bdo><ul id='mdKu5'></ul>

                  <tbody id='mdKu5'></tbody>
                1. 本文介绍了PHP - if 语句中的倒序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这个问题困扰了我很久,一直找不到答案...注意到它被 Zend 框架开发人员大量使用,

                  This is a question that is bugging me for a long time and can't find any answer... Noticed it's used quite a lot by Zend Framework Developers,

                  以下两个if"语句有什么区别?:

                  What is the difference between following 2 "if" statements? :

                  if (null === $this->user) { ... }
                  
                  if ($this->user === null) { ... }
                  

                  对我来说第一个看起来有点奇怪;]

                  To me the first one looks kinda odd ;]

                  感谢您的回答.

                  推荐答案

                  这与您的脚本的工作方式没有区别,它只是一个编码标准,一个建议

                  This is not a difference for the way your script works, it's just a coding standard, a recommendation

                  推荐使用这种方式的原因:

                  The reason why it is recommended to use it this way:

                  if (null == $this->user)
                  

                  的事实是,如果你输入错误并写 = 而不是 == 你会得到一个错误,而

                  is the fact that if you mistype and write = instead of == you will get an error, while

                  ($this->user = null)
                  

                  代替

                  ($this->user == null)
                  

                  有效但会导致奇怪的错误(赋值和最终值被评估为 bool 而不是比较)

                  works but causes weird bugs (assignment and the final value is evaluated as bool instead of comparison)

                  我猜它只是作为一种习惯扩展到严格比较运算符 (===)

                  and I guess it just extended as a habit to the strict comparison operator (===)

                  更新:因为我发现即使在我发布答案 3 年后该线程上仍有一些活动,所以我想我会添加一些我忘记提及的内容.这种类型的符号称为 yoda conditions,您可以在 this 上阅读有关它的更多信息例如维基百科页面.

                  Update: since I see that there's still some activity on this thread even 3 years after I posted the answer I figured I would add something I forgot to mention. This type of notation is known as yoda conditions, you can read more about it on this wikipedia page for example.

                  这篇关于PHP - if 语句中的倒序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='txjAf'><tr id='txjAf'><dt id='txjAf'><q id='txjAf'><span id='txjAf'><b id='txjAf'><form id='txjAf'><ins id='txjAf'></ins><ul id='txjAf'></ul><sub id='txjAf'></sub></form><legend id='txjAf'></legend><bdo id='txjAf'><pre id='txjAf'><center id='txjAf'></center></pre></bdo></b><th id='txjAf'></th></span></q></dt></tr></i><div id='txjAf'><tfoot id='txjAf'></tfoot><dl id='txjAf'><fieldset id='txjAf'></fieldset></dl></div>

                  • <small id='txjAf'></small><noframes id='txjAf'>

                          <tbody id='txjAf'></tbody>
                        <legend id='txjAf'><style id='txjAf'><dir id='txjAf'><q id='txjAf'></q></dir></style></legend><tfoot id='txjAf'></tfoot>
                          <bdo id='txjAf'></bdo><ul id='txjAf'></ul>