note 44766 deleted from function.substr by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 16 Aug 2004 03:08:05 +0000 |
| Subject: | note 44766 deleted from function.substr by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74745@lists.php.net to get a copy of this message | ||
Note Submitter: Dr_Solipsist at hotmail dot com
----
The the following function posted by blackbunny:
//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);
can simply be replaced by:
$string = "000101231";
echo $string*=1;