fm_get_variable


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.

 

Example 1 - Get a string variable
fm_set_variable('foo', 'bar');
echo fm_get_variable('foo');
/*
Returns: bar
*/
Example 2 - Get a non-existent variable
fm_unset('foo');
echo gettype(fm_get_variable('foo'));
/*
Returns: NULL
*/

Change Log

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