Home > Backend Development > PHP Tutorial > php 数字格式化输出

php 数字格式化输出

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:15:00
Original
2265 people have browsed it

往往是对于一些订单编号我们需要对数据库取出的编号进行格式化,比如在前面补0等等,

下面介绍的是php格式化输出编号的方法

$var = sprintf("%06d",22);
Copy after login

得到的结果是000022

6指定位数~

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template