note 44599 added to function.substr
| From: | blackbunny at gmail dot com | Date: | Tue, 10 Aug 2004 20:57:32 +0000 |
| Subject: | note 44599 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74415@lists.php.net to get a copy of this message | ||
if your string like "0000053004". you can use this function. this function erase
"0" from your string start.
function nozerofirst($string) {
$dongu=strlen($string);
for ($i=0; $i<$dongu; $i++) {
$g=10-$i;
$u=substr($string,$i,1);
if ($u!=0) {
$a= substr($string,$i,$g)."<br>";
break;
}
}
return $a;
}
$string = "000101231";
echo nozerofirst($string);
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44599
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44599&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44599&report=yes
Search -- http://master.php.net/manage/user-notes.php