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

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

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

      <legend id='jRvzG'><style id='jRvzG'><dir id='jRvzG'><q id='jRvzG'></q></dir></style></legend>

      <tfoot id='jRvzG'></tfoot>

      1. PHP - if 语句中的倒序

        时间:2023-10-03
          <tfoot id='f1OA9'></tfoot>
          <i id='f1OA9'><tr id='f1OA9'><dt id='f1OA9'><q id='f1OA9'><span id='f1OA9'><b id='f1OA9'><form id='f1OA9'><ins id='f1OA9'></ins><ul id='f1OA9'></ul><sub id='f1OA9'></sub></form><legend id='f1OA9'></legend><bdo id='f1OA9'><pre id='f1OA9'><center id='f1OA9'></center></pre></bdo></b><th id='f1OA9'></th></span></q></dt></tr></i><div id='f1OA9'><tfoot id='f1OA9'></tfoot><dl id='f1OA9'><fieldset id='f1OA9'></fieldset></dl></div>

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

                <bdo id='f1OA9'></bdo><ul id='f1OA9'></ul>
              • <legend id='f1OA9'><style id='f1OA9'><dir id='f1OA9'><q id='f1OA9'></q></dir></style></legend>

                    <tbody id='f1OA9'></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 语句中的倒序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在一行上显示 Zend_Form_Element_Radio 下一篇:JavaScript Ajax 请求 vs jQuery $.ajax

                  相关文章

                  最新文章

                  <tfoot id='d24Rf'></tfoot>
                  1. <legend id='d24Rf'><style id='d24Rf'><dir id='d24Rf'><q id='d24Rf'></q></dir></style></legend>

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

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