Function __global->get_value
Definitions
sources/config.php
- Find a specified value. Values are set with set_value.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: string
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $name | ID_TEXT | No | No | required parameter | N/A | N/A | The name of the value |
| $default | ?ID_TEXT | No | No | Null | N/A | N/A | Value to return if value not found (null: return null) |
| $elective_or_lengthy | boolean | No | No | False | N/A | N/A | Whether this value is an elective/lengthy one. Use this for getting & setting if you don't want it to be loaded up in advance for every page view (in bulk alongside other values), or if the value may be more than 255 characters. Performance trade-off: frequently used values should not be elective, infrequently used values should be elective. |
| $env_also | boolean | No | No | False | N/A | N/A | Whether to also check server environmental variables. Only use if $elective_or_lengthy is set to false |
Returns
- The value (null: value not found and default is null)
- Type: ?SHORT_TEXT
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Find a specified value. Values are set with set_value.
*
* @param ID_TEXT $name The name of the value
* @param ?ID_TEXT $default Value to return if value not found (null: return null)
* @param boolean $elective_or_lengthy Whether this value is an elective/lengthy one. Use this for getting & setting if you don't want it to be loaded up in advance for every page view (in bulk alongside other values), or if the value may be more than 255 characters. Performance trade-off: frequently used values should not be elective, infrequently used values should be elective.
* @param boolean $env_also Whether to also check server environmental variables. Only use if $elective_or_lengthy is set to false
* @return ?SHORT_TEXT The value (null: value not found and default is null)
*/
function get_value(string $name, ?string $default = null, bool $elective_or_lengthy = false, bool $env_also = false) : ?string
* Find a specified value. Values are set with set_value.
*
* @param ID_TEXT $name The name of the value
* @param ?ID_TEXT $default Value to return if value not found (null: return null)
* @param boolean $elective_or_lengthy Whether this value is an elective/lengthy one. Use this for getting & setting if you don't want it to be loaded up in advance for every page view (in bulk alongside other values), or if the value may be more than 255 characters. Performance trade-off: frequently used values should not be elective, infrequently used values should be elective.
* @param boolean $env_also Whether to also check server environmental variables. Only use if $elective_or_lengthy is set to false
* @return ?SHORT_TEXT The value (null: value not found and default is null)
*/
function get_value(string $name, ?string $default = null, bool $elective_or_lengthy = false, bool $env_also = false) : ?string
