W3cubDocs

/WordPress

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( floatval( $maybe_integer ) ) === floatval( $maybe_integer );
}

Changelog

Version Description
5.5.0 Introduced.

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