Home >Backend Development >PHP Tutorial >去掉php数目字左边的零

去掉php数目字左边的零

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:21:561652browse

去掉php数字左边的零

//去掉php数字里左边的零

? ? ? ? ? ? for ($i=0; $i

? ? ? ? ? ? //循环一次,指针向右移动一次

? ? ? ? ? ? ? ? $newUser[$i] = substr($user_name, $i, 4);

? ? ? ? ? ? ? ? //如果被截取的第一个数为零,则将零换为空

? ? ? ? ? ? ? ? if (0 == substr($newUser[$i], 0, 1)) {

? ? ? ? ? ? ? ? ? ? $newUserName[$i] = str_replace(0,"",$newUser[$i]);

? ? ? ? ? ? ? ? } else {

? ? ? ? ? ? ? ? //循环结束,跳出循环

? ? ? ? ? ? ? ? ? ? $getUserName = $newUser[$i];

? ? ? ? ? ? ? ? ? ? break;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

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