llms_rest_validate_positive_float( integer $number, boolean $include_zero = true )
Validate strict positive float number
Parameters Parameters
- $number
-
(integer) (Required) Float number to validate.
- $include_zero
-
(boolean) (Optional) Whether or not 0 is included. Default is
true
.Default value: true
Return Return
(boolean)
Source Source
File: libraries/lifterlms-rest/includes/server/llms-rest-server-functions.php
function llms_rest_validate_positive_float( $number, $include_zero = true ) { // @TODO min_range and max_range options for FILTER_VALIDATE_FLOAT are only available since PHP 7.4. $is_float = false !== filter_var( (float) $number, FILTER_VALIDATE_FLOAT ); return $is_float && ( $include_zero ? $number >= 0 : $number > 0 ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
[versoin] | Introduced. |