Versions Compared

Key

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

mixed fm_get_variable ( string $name )


 

Description


Allows you to get the value of a variable that's been stored using fm_set_variable.

 

Parameters


name  (required)
The name of the variable to get.

 

Return


Returns the value if the variable exists, otherwise NULL. Keep in mind that there’s a difference between an empty string ‘’ and NULL. It’s perfectly legitimate for a variable to exist and the value to be empty. You can use fm_isset to determine whether or not a variable exists.


Errors


There are no errors for this function.

 

Code Block
themeEclipse
languagephp
titleExample 1 - Get a string variable
fm_set_variable('foo', 'bar');
echo fm_get_variable('foo');
/*
Returns: bar
*/
Code Block
themeEclipse
languagephp
titleExample 2 - Get a non-existent variable
fm_unset('foo');
$fooecho = gettype(fm_get_variable('foo');
echo gettype($foo);
/*
Returns: NULL
*/

Change Log

VersionDescription
3.0.0Returns the variable types now supported by fm_set_variable (bool, int, double, string, array).