absint()将字符串/非整数值转换为整数

目录

描述

Converts a value to a non-negative integer.

Synonym of abs( intval( $foo ) ).

absint() 描述

用法

<?php absint$maybeint ); ?>

absint() 用法

参数

$maybeint

(mixed) (必填) Data you wish to have converted to a non-negative integer.

默认值: None

absint() 参数

返回值

(int

A non-negative integer.

absint() 返回值

历史

添加于 版本: 2.5

absint() 历史

源文件

absint() 函数的代码位于 wp-includes/functions.php

/* ----------------------------------
 * wordpress之魂 © http://wphun.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 ) );
}

absint() 源文件