Auto Posted January 21, 2007 Share Posted January 21, 2007 Hi there,I'm curious if there is a way to strip leading zeroes from a number? I am making a page to calculate scores from a game, and, when it shows the scores on the "leaderboard" page, it will show numbers below 100 as 05, 020, etc., etc., when it should show 5 or 20.Any way to do this without having to run a giant if, then statement?Thanks in advance! Quote Link to comment Share on other sites More sharing options...
kobmat Posted January 21, 2007 Share Posted January 21, 2007 Try echo (int)$score; Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 21, 2007 Share Posted January 21, 2007 intval() should also work. Quote Link to comment Share on other sites More sharing options...
Auto Posted January 21, 2007 Author Share Posted January 21, 2007 Thank you both for the speedy responses. The latter worked like a charm! Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.