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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:06:081576browse

怎么把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), '/');


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);

Statement:
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