note 44599 deleted from function.substr by aidan
| From: | aidan@php.net | Date: | Sun, 22 Aug 2004 11:18:26 +0000 |
| Subject: | note 44599 deleted from function.substr by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75095@lists.php.net to get a copy of this message | ||
Note Submitter: blackbunny at gmail dot com
----
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);