Solved

trim leading zero

Posted on 2006-10-24
2
790 Views
Last Modified: 2013-12-12
I have 04 written in a database. i am need to echo the variable but trim the leading zero.  Is there a php function to do this?
0
Comment
Question by:lvollmer
  • 2
2 Comments
 
LVL 29

Expert Comment

by:TeRReF
ID: 17798254
The fastest way to do this:

$var = '04';
print((int)$var);
0
 
LVL 29

Accepted Solution

by:
TeRReF earned 500 total points
ID: 17798298
If you want a function, use this:

<?php
$var = '04';
print(intval($var));
?>
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question