rest_is_integer() WordPress Function
The rest_is_integer() function can be used to check whether a given value is an integer or not. This is useful when dealing with values that may be strings or integers.
rest_is_integer( mixed $maybe_integer ) #
Determines if a given value is integer-like.
Parameters
- $maybe_integer
(mixed)(Required)The value being evaluated.
Return
(bool) True if an integer, otherwise false.
Source
File: wp-includes/rest-api.php
function rest_is_integer( $maybe_integer ) { return is_numeric( $maybe_integer ) && round( (float) $maybe_integer ) === (float) $maybe_integer; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.5.0 | Introduced. |