Removing Leading Zeros in PHP

It’s pretty easy to do, many thanks to laserlight at phpbuilder:

$var = ltrim($var, '0');

If there’s more than one zero use the following:

$value = 003;
$value = intval($value);
This entry was posted in News. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>