描述
将值转换为非负整数。
abs( intval( $foo ) 的同义词)。
用法
<?php absint( $maybeint ); ?>
参数
$maybeint
(mixed) (必填) 您希望转换为非负整数的数据。
返回值
非负整数。
历史
添加于 版本: 2.5
源文件
absint() 函数的代码位于 wp-includes/functions.php
/* ———————————-
* wordpress函数 xingkongWeb.com收集
* ———————————- */
/**
* Convert a value to non-negative integer.
*
* @since 2.5.0
*
* @param mixed $maybeint Data you wish to have converted to a non-negative integer.
* @return int A non-negative integer.
*/
function absint( $maybeint ) {
return abs( intval( $maybeint ) );
}