Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 808
  • Last Modified:

trim leading zero

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
lvollmer
Asked:
lvollmer
  • 2
1 Solution
 
TeRReFCommented:
The fastest way to do this:

$var = '04';
print((int)$var);
0
 
TeRReFCommented:
If you want a function, use this:

<?php
$var = '04';
print(intval($var));
?>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now