Function __global->float_format
Definitions
sources/global3.php
- Format the given float number as a nicely formatted string. Inverted with float_unformat.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: string
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $val | float | No | No | required parameter | N/A | N/A | The value to format |
| $decs_wanted | integer | No | No | 2 | N/A | N/A | The number of fractional digits |
| $only_needed_decs | boolean | No | No | False | N/A | N/A | Whether to trim trailing zeros |
Returns
- Nicely formatted string
- Type: string
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Format the given float number as a nicely formatted string. Inverted with float_unformat.
*
* @param float $val The value to format
* @param integer $decs_wanted The number of fractional digits
* @param boolean $only_needed_decs Whether to trim trailing zeros
* @return string Nicely formatted string
*/
function float_format(float $val, int $decs_wanted = 2, bool $only_needed_decs = false) : string
* Format the given float number as a nicely formatted string. Inverted with float_unformat.
*
* @param float $val The value to format
* @param integer $decs_wanted The number of fractional digits
* @param boolean $only_needed_decs Whether to trim trailing zeros
* @return string Nicely formatted string
*/
function float_format(float $val, int $decs_wanted = 2, bool $only_needed_decs = false) : string

