The ZPE unset
feature has been included as a YASS language keyword since ZPE 1.12.4. Prior to
this it was a predefined function which can be found here.
unset
destroys any references to a variable.
It follows the standard variable hierarchy in that it will find a local
variable, then a parameter then a global variable which if not found will
result in the function returning false
.
Using unset
The unset
feature works like a function syntactically but it differs in it's
implementation.
$a = 10 unset($a) print($a) $b = [11, 22, 33] unset($b[2]) print($b)
Before becoming a keyword
Prior to unset
becoming a language keyword, the
unset
was a function. Part of the design philosophy
behind making a keyword was to make execution faster as it was a widely used
function but whilst maintaining compatibility with existing scripts.
The unset
function is one of the oldest functions
in ZPE. You can read more about it here.