get()
get(string $k, mixed $default = false) : mixed
Retrieve a setting value. Returns the default value if
not found.
Keep in mind that the settings manager is type aware, so values
will be returned as a scalar, array or object. For example:
$manager->set('some-key', true);
$manager->get('some-key'); // Will be scalar TRUE
Similarly, if you pass a string number, it will be converted to a scalar
float or int:
$manager->set('some-key', '3.14159');
echo $manager->get('some-key') === '3.14159' ? 'Equal' : 'Not equal'; // Not equal
echo $manager->get('some-key') === 3.14159 ? 'Equal' : 'Not equal'; // Equal
Parameters
string |
$k |
Setting key |
mixed |
$default |
Default value to return |
Throws
- \Exception
if unable to decode value
Returns
mixed