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

去掉php数目字左边的零

WBOY
Release: 2016-06-13 12:48:06
Original
1058 people have browsed it

去掉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;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

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