public static function asFloat($data, $default = null)
    {
        $float = filter_var($data ?? '', FILTER_VALIDATE_FLOAT);

        return $float !== false ? $float : $default;
    }
public static function asFloat($data, $default = null)
    {
        $float = filter_var($data ?? '', FILTER_VALIDATE_FLOAT);

        return $float !== false ? $float : $default;
    }
public static function asFloat ( $ data , $ default = null ) { $ float = filter_var ( $ data ?? '' , FILTER_VALIDATE_FLOAT ) ; return $ float !== false ? $ float : $ default ; }
Parameter return as float.

@param mixed $data    → data to convert
@param mixed $default → default value in error case

@return mixed → value, null or customized return value
Parameter return as float .