Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

bool fm_unset ( string $name )


 

Description


Allows you to destroy an existing variable. Just like when you were young, it’s important to clean up after yourself.

 

Parameters


name (required)

The name of the variable to destroy.

 

Return


Returns true if the variable existed or false if the variable did not exist.


Errors


There are no errors for this function.

 

Code Block
themeEclipse
languagephp
titleExample 1 - Unset a variable that exists
fm_set_variable('foo', 'bar');
$destroyed = fm_unset('foo');

if ($destroyed) {
  echo 'foo existed and is now destroyed';
} else {
  echo 'foo did not exist so nothing was destroyed, sorry';
}
/*
Returns: foo existed and is now destroyed
*/
Code Block
themeEclipse
languagephp
titleExample 2 - Unset a variable that does not exist
fm_unset('foo');
$destroyed = fm_unset('foo');

if ($destroyed) {
  echo 'foo existed and is now destroyed';
} else {
  echo 'foo did not exist so nothing was destroyed, sorry';
}
/*
Returns: foo did not exist so nothing was destroyed, sorry
*/

Jira Legacy
serverJIRA (scodigo.atlassian.net)
serverId83b5fb2e-920e-352e-9025-a23e0e7cec5c
keySP-1