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;
}

Changelog

Version Description
5.5.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/rest_is_integer