Re: Leading zeroes
| From: | Rasmus Lerdorf | Date: | Thu, 23 May 2002 17:19:05 +0000 |
| Subject: | Re: Leading zeroes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98953@lists.php.net to get a copy of this message | ||
$str = ltrim($str,'0');
would be more efficient.
On Thu, 23 May 2002, Michael Sims wrote:
> On Thu, 23 May 2002 09:26:05 -0700 (PDT), you wrote:
>
> >Does anybody have a clever and efficient way of
> >getting rid of leading zeroes in a string?
>
> How about:
>
> $str = preg_replace("/^0+/","",$str);
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>