Miscellaneous
Several functions do not fall under the other categories and so are covered here. The first one is isset(), which takes one or more variables as its parameters and returns true if they have been set. It is important to note that a variable with a value set to something that would be evaluated to false—such as 0 or an empty string—still returns true from isset() because it does not check the value of the variable. It merely checks that it is set; hence, the name.
The unset() function also takes one or more variables as its parameters, simply deleting the variable and freeing up the memory. With these two, you can write a script that checks for the existence of a variable and, if it exists, deletes it (see Listing 39.5).
Listing 39.5. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access