> -----Original Message-----
> From: Liam Gibbs [mailto:[EMAIL PROTECTED]]
> Sent: 23 May 2002 17:26
> 
> Does anybody have a clever and efficient way of
> getting rid of leading zeroes in a string?

>From version 4.1.0, $str = ltrim($str, '0') (see 
>http://www.php.net/manual/en/function.ltrim.php).

For older versions, how about:

    $str = substr($str, strspn($str, '0'));

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to