Home > Backend Development > PHP Tutorial > 如何把000000001转换成000/00/00/01

如何把000000001转换成000/00/00/01

WBOY
Release: 2016-06-13 12:58:28
Original
1401 people have browsed it

怎么把000000001转换成000/00/00/01?
怎么把000000001转换成000/00/00/01?
------解决方案--------------------

$s = '000000001';<br />
echo trim(preg_replace('/^\d{1,3}<br><font color='#FF8000'>------解决方案--------------------</font><br>\d{2}/', '$0/', $s), '/');
Copy after login


000/00/00/01

------解决方案--------------------
$s='000000001';
$array=array();
$array[]=substr($s,0,3);
$array[]=substr($s,3,2);
$array[]=substr($s,5,2);
$array[]=substr($s,7,2);
echo implode('/',$array);

Related labels:
source:php.cn
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