Core Function Unset
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> Unset( $variable ) </pre> === Description === Delete a variable === Parameters === ==== $variable ==== A variable to delete. === Return Value === None === Remarks =...") |
m (1 revision) |
||
(9 intermediate revisions by one user not shown) | |||
Line 15: | Line 15: | ||
=== Return Value === | === Return Value === | ||
− | + | Success - Returns true. | |
+ | |||
+ | Failure - Returns false. | ||
=== Remarks === | === Remarks === | ||
This can be used to delete DLLStructs, GUI objects and Classes. | This can be used to delete DLLStructs, GUI objects and Classes. | ||
+ | |||
+ | Its worth noting to delete from an array you must use the array directly example unset( $a[400] ) you cannot place that element into a variable then expect to unset it and remove it from the array it will not instead it will simple set the element int the array to zero. | ||
+ | |||
+ | The class function __Destruct() is called when Unset() is used on a class. | ||
=== Example === | === Example === | ||
<syntaxhighlight lang="sputnik"> | <syntaxhighlight lang="sputnik"> | ||
− | unset( $a ); // Delete single variable | + | unset( $a ); // Delete single variable named |
unset( $a[500] ); // Delete variable from array | unset( $a[500] ); // Delete variable from array | ||
unset( $a["test"] ); // Delete variable from hash | unset( $a["test"] ); // Delete variable from hash |
Latest revision as of 12:38, 14 June 2015
Unset( $variable )
Contents |
Description
Delete a variable
Parameters
$variable
A variable to delete.
Return Value
Success - Returns true.
Failure - Returns false.
Remarks
This can be used to delete DLLStructs, GUI objects and Classes.
Its worth noting to delete from an array you must use the array directly example unset( $a[400] ) you cannot place that element into a variable then expect to unset it and remove it from the array it will not instead it will simple set the element int the array to zero.
The class function __Destruct() is called when Unset() is used on a class.
Example
unset( $a ); // Delete single variable named unset( $a[500] ); // Delete variable from array unset( $a["test"] ); // Delete variable from hash