WordPress 功能函数——absint(将值转换为非负整数)

用法

absint( mixed $maybeint )

将值转换为非负整数。

参数

$maybeint
(mixed)(必需)您希望转换为非负整数的数据。

返回

(int)非负整数。

来源

文件:wp-includes/functions.php

function absint( $maybeint ) {
return abs( intval( $maybeint ) );
}

用户贡献的笔记

传递负整数时,您将获得非负的绝对值。传递非int字符串返回0,但是传递-10,返回10:

echo absint( 'number' );        // 0
echo absint( 10 );              // 10
echo absint( -10 );             // 10

传递float时,它将返回整数值

echo absint(20.33);            // 20
echo absint(-20.33);           // 20
echo absint(false);            // 0
echo absint(true);             // 1
echo absint(array(10,20,30))   // 1
echo absint(NULL)              // 0
本文原创,作者:萨龙龙,其版权均为4166am金沙信心之选所有。
如需转载,请注明出处:/wordpress-functions-absint.html
absint(mixed$maybeint)
\u5c06\u503c\u8f6c\u6362\u4e3a\u975e\u8d1f\u6574\u6570\u3002
\u53c2\u6570
$maybeint
(mixed)(\u5fc5\u9700)\u60a8\u5e0c\u671b\u8f6c\u6362\u4e3a\u975e\u8d1f\u6574\u6570\u7684\u6570\u636e\u3002
\u8fd4\u56de
(int)\u975e\u8d1f\u6574\u6570\u3002
\u6765\u6e90
\u6587\u4ef6\uff1awp-includes\/function\u2026@\u8428\u9f99\u7f51\u7edc&appkey=746468751&pic=https:\/\/demo.salongweb.com\/mnews\/images\/default-thumb.jpg&searchPic=true","qq":"https:\/\/connect.qq.com\/widget\/shareqq\/index.html?url=https:\/\/salongweb.com\/wordpress-functions-absint.html&title=WordPress \u529f\u80fd\u51fd\u6570\u2014\u2014absint(\u5c06\u503c\u8f6c\u6362\u4e3a\u975e\u8d1f\u6574\u6570)&pics=https:\/\/demo.salongweb.com\/mnews\/images\/default-thumb.jpg&summary=\u7528\u6cd5
absint(mixed$maybeint)
\u5c06\u503c\u8f6c\u6362\u4e3a\u975e\u8d1f\u6574\u6570\u3002
\u53c2\u6570
$maybeint
(mixed)(\u5fc5\u9700)\u60a8\u5e0c\u671b\u8f6c\u6362\u4e3a\u975e\u8d1f\u6574\u6570\u7684\u6570\u636e\u3002
\u8fd4\u56de
(int)\u975e\u8d1f\u6574\u6570\u3002
\u6765\u6e90
\u6587\u4ef6\uff1awp-includes\/function\u2026&site=\u8428\u9f99\u7f51\u7edc","zone":"https:\/\/sns.qzone.qq.com\/cgi-bin\/qzshare\/cgi_qzshare_onekey?url=https:\/\/salongweb.com\/wordpress-functions-absint.html&title=WordPress \u529f\u80fd\u51fd\u6570\u2014\u2014absint(\u5c06\u503c\u8f6c\u6362\u4e3a\u975e\u8d1f\u6574\u6570)&desc=\u7528\u6cd5
absint(mixed$maybeint)
\u5c06\u503c\u8f6c\u6362\u4e3a\u975e\u8d1f\u6574\u6570\u3002
\u53c2\u6570
$maybeint
(mixed)(\u5fc5\u9700)\u60a8\u5e0c\u671b\u8f6c\u6362\u4e3a\u975e\u8d1f\u6574\u6570\u7684\u6570\u636e\u3002
\u8fd4\u56de
(int)\u975e\u8d1f\u6574\u6570\u3002
\u6765\u6e90
\u6587\u4ef6\uff1awp-includes\/function\u2026&summary=&site=\u8428\u9f99\u7f51\u7edc"}>
absint(mixed$maybeint)
\u5c06\u503c\u8f6c\u6362\u4e3a\u975e\u8d1f\u6574\u6570\u3002
\u53c2\u6570
$maybeint
(mix\u2026","thumb":"https:\/\/demo.salongweb.com\/mnews\/images\/default-thumb.jpg","date":{"day":"02","year":"2019\/04"},"desc":"WordPress\u4e3b\u9898|WordPress \u4f01\u4e1a\u4e3b\u9898|WordPress \u5546\u57ce\u4e3b\u9898|\u9ad8\u54c1\u8d28\u7f51\u7ad9\u5b9a\u5236","style":{"light":{"logo":"https:\/\/pic.salongweb.com\/2022\/12\/logo-light.png","title":"#242F40","text":"#5B6B82","meta":"#9AA7B9","border":"#EFF5FF","bg":"#fff"},"dark":{"logo":"https:\/\/pic.salongweb.com\/2022\/12\/logo-dark.png","title":"#B1C1E8","text":"#b3bdd3","meta":"#565E75","border":"#1C2032","bg":"#171B2C"}}} :loading="posterLoading">