toNumber.php
Table of Contents
Functions
- toNumber() : float|int|false
- Converts a value to a numeric type (int or float) if possible.
Functions
toNumber()
Converts a value to a numeric type (int or float) if possible.
toNumber(mixed $value[, int|float|false $default = false ]) : float|int|false
Returns false if the value cannot be interpreted as a number.
This is useful to safely normalize user input or data that might contain numeric strings.
Parameters
- $value : mixed
-
The value to convert.
- $default : int|float|false = false
-
The default value if the value is not a numeric value.