Clarified highly-misleading (unset) casting example. Resolves bug #55164.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@322117 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Justin Martin 2012-01-12 05:23:03 +00:00
parent d508aa1de0
commit c7c5b9cbe2

View file

@ -228,16 +228,30 @@ unset($foo1, $foo2, $foo3);
</programlisting>
</example>
<example>
<title>Using (unset) casting</title>
<title>Using <literal>(unset)</literal> casting</title>
<para>
<literal>(unset)</literal> casting is often confused with the
<function>unset</function> function. <literal>(unset)</literal>
casting serves only as a <literal>NULL</literal>-type cast, for
completeness. It does not alter the variable it's casting.
</para>
<programlisting role="php">
<![CDATA[
<?php
$name = 'Felipe';
var_dump((unset) $name);
var_dump($name);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
NULL
string(6) "Felipe"
]]>
</screen>
</example>
</para>
</refsect1>