mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
- empty clarified, noted it is a language construct
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@47588 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
6ea02e0092
commit
dff9971ff5
1 changed files with 24 additions and 7 deletions
|
@ -48,13 +48,26 @@ print $double_value_of_var; // prints 122.34343
|
|||
<title>Description</title>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>int <function>empty</function></funcdef>
|
||||
<funcdef>boolean <function>empty</function></funcdef>
|
||||
<paramdef>mixed <parameter>var</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<note>
|
||||
<para>
|
||||
<function>empty</function> is a language construct.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
Returns false if <parameter>var</parameter> is set and has a
|
||||
non-empty or non-zero value; true otherwise.
|
||||
This is the opposite of
|
||||
<literal>(boolean) <parameter>var</parameter></literal>,
|
||||
exept that no warning is generated when the variable is not set.
|
||||
See <link linkend="language.types.boolean.casting">converting
|
||||
to boolean</link> for more information.
|
||||
</para>
|
||||
|
||||
<!-- Returns false if <parameter>var</parameter> is set and has a
|
||||
non-empty or non-zero value; true otherwise. -->
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
$var = 0;
|
||||
|
@ -68,12 +81,13 @@ if (!isset($var)) { // evaluates false
|
|||
}
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
|
||||
<simpara>
|
||||
Note that this is meaningless when used on anything which isn't a
|
||||
variable; i.e. <command>empty (addslashes ($name))</command> has
|
||||
no meaning since it would be checking whether something which
|
||||
isn't a variable is a variable with a false value.
|
||||
<!-- will even result in parse error (at least in PHP 4) -->
|
||||
</simpara>
|
||||
<simpara>
|
||||
See also <function>isset</function> and
|
||||
|
@ -103,7 +117,7 @@ if (!isset($var)) { // evaluates false
|
|||
Possibles values for the returned string are:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>"boolean"</simpara>
|
||||
<simpara>"boolean" (since PHP 4)</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>"integer"</simpara>
|
||||
|
@ -121,13 +135,16 @@ if (!isset($var)) { // evaluates false
|
|||
<simpara>"object"</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>"resource"</simpara>
|
||||
<simpara>"resource" (since PHP 4)</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>"NULL" (since PHP 4)</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>"user function" (PHP 3 only, deprecated)</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>"unknown type"</simpara>
|
||||
<simpara>"unknown type"<!-- someone's joking? --></simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
|
Loading…
Reference in a new issue