Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 805
  • 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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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