百度 | 神马 | 搜狗 | 技术文档 | 学习资料分享 - 记录帝国CMS及运维技术的点点滴滴
你的位置:首页 > 实用IT技术 » 正文

【Wordpress相关】WordPress 常用函数 / zeroise

发布时间:2020-09-17

作品分类:Wordpress相关  前导  添加  数字  函数  常用  WordPress  zeroise

WordPress 常用函数 / zeroise,

简介

添加必要的前导零。

如果 $threshold 设置为’4’,并且 $number 是是’10’,返回’0010’,如果 $number 是’5000’,返回’5000’。

主要使用 sprintf 根据 $threshold 参数和数字本身的长度来填充前导零,如果数字本身够长,就不会有零添加。

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>

用法

<?php zeroise( $number, $threshold ); ?>

参数

$number
(mixed) (required) 要添加前导零的数字。
Default: None

$threshold
(integer) (required) 添加前导零之后的数字的长度。
Default: None

返回值

(string)
添加前导零之后的数字。

修改记录

Since: 0.71

源文件

wp-includes/formatting.php

Top