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

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

        <tfoot id='NTgXN'></tfoot>
      1. <small id='NTgXN'></small><noframes id='NTgXN'>

        null 和 empty 和有什么不一样?

        时间:2023-10-15

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

            1. <small id='4tRZA'></small><noframes id='4tRZA'>

                • <bdo id='4tRZA'></bdo><ul id='4tRZA'></ul>
                  <legend id='4tRZA'><style id='4tRZA'><dir id='4tRZA'><q id='4tRZA'></q></dir></style></legend>
                    <tbody id='4tRZA'></tbody>

                  本文介绍了null 和 empty 和有什么不一样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我对空和空的概念很陌生.虽然我已经努力了解它们之间的区别,但我更加困惑.我在 http://www.tutorialarena.com/blog/php-isset- 上看到了一篇文章vs-empty.php 但是我仍然没有看到您在验证表单时何时会使用 isset 和 empty .看不懂区别,不想用错的功能,也不想用其他方面的功能.有人可以举例帮助我理解吗?我对编码非常陌生,所以如果有人能给我提供真实世界的例子,同时保持它足够简单以供新手遵循,我将不胜感激.

                  I am new to the concept of empty and null. Whilst I have endeavoured to understand the difference between them, I am more confused. I came across an article at http://www.tutorialarena.com/blog/php-isset-vs-empty.php however I still don't see when you would use isset and empty when validating forms. Seeing that I don't grasp the difference, I don't want to be using the incorrect functions as well as not be able to use the functions in other areas. Can someone give examples that will help me understand? I am very new to coding so would appreciate if someone could give me real world examples and at the same time keep it simply enough for noob to follow.

                  推荐答案

                  一个变量是 NULL 如果它没有值,并且不指向内存中的任何地方.

                  A variable is NULL if it has no value, and points to nowhere in memory.

                  empty() 更像是 empty 的字面意思,例如字符串 "" 为空,但 not NULL.

                  empty() is more a literal meaning of empty, e.g. the string "" is empty, but is not NULL.

                  以下几点被认为是为空:

                  The following things are considered to be empty:

                  • ""(空字符串)
                  • 0(0 作为整数)
                  • 0.0(0 作为浮点数)
                  • "0" (0 作为字符串)
                  • 错误
                  • array()(空数组)
                  • var $var;(声明了一个变量,但在类中没有值)

                  来源.

                  $aNULL.

                  $a = ''empty,但不是 NULL.

                  如果 $a='' 为空但不是 NULL,我什么时候使用 empty() 函数,什么时候使用isset() 函数.

                  If $a='' is empty but not NULL, when do I use the empty() function and when do I use the isset() function.

                  isset() 将返回 FALSE 是指向 NULL 的变量.

                  当您了解什么是 empty 时,请使用 empty()(查看上面的列表).

                  Use empty() when you understand what is empty (look at the list above).

                  另外,当你说它在内存中无处指向时,这究竟是什么意思?

                  Also when you say it points nowhere in memory, what does that mean exactly?

                  这意味着 $str = '' 将作为长度为 0 的字符串存在于内存中.

                  It means that $str = '' will be in memory as a string with length of 0.

                  如果是$str = NULL,就不会占用内存.

                  If it were $str = NULL, it would not occupy any memory.

                  这篇关于null 和 empty 和有什么不一样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:PHP 检查 NULL 下一篇:PHP 认为 null 等于零

                  相关文章

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

                    <small id='9fb6d'></small><noframes id='9fb6d'>

                  2. <legend id='9fb6d'><style id='9fb6d'><dir id='9fb6d'><q id='9fb6d'></q></dir></style></legend>

                      <tfoot id='9fb6d'></tfoot>