Add a second optional parameter to absint()
to limit the result to PHP_INT_MAX
.
See #23383. git-svn-id: https://develop.svn.wordpress.org/trunk@28855 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
146bcaa937
commit
df04529010
@ -3000,10 +3000,15 @@ function dead_db() {
|
|||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*
|
*
|
||||||
* @param mixed $maybeint Data you wish to have converted to a nonnegative integer
|
* @param mixed $maybeint Data you wish to have converted to a nonnegative integer
|
||||||
|
* @param bool $limit Whether to only return up to PHP_INT_MAX.
|
||||||
* @return int An nonnegative integer
|
* @return int An nonnegative integer
|
||||||
*/
|
*/
|
||||||
function absint( $maybeint ) {
|
function absint( $maybeint, $limit = false ) {
|
||||||
return abs( intval( $maybeint ) );
|
$int = abs( intval( $maybeint ) );
|
||||||
|
if ( $limit && $int > PHP_INT_MAX ) {
|
||||||
|
$int = PHP_INT_MAX;
|
||||||
|
}
|
||||||
|
return $int;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user