Reputation: 377
Today I try this:
(unset) $myVar;
This form is accepted in php 5.2, but where it can be used?
P.S. Actually variable will not be destroyed :)
Upvotes: 1
Views: 37
Reputation: 46602
RTM: http://php.net/manual/en/function.unset.php
Example #2 Using (unset) casting
(unset) casting is often confused with the unset() function. (unset) casting serves only as a NULL-type cast, for completeness. It does not alter the variable it's casting.
<?php
$name = 'Felipe';
var_dump((unset) $name);
var_dump($name);
?>
The above example will output:
NULL
string(6) "Felipe"
Upvotes: 4