gibigbig Posted June 21, 2011 Share Posted June 21, 2011 Is there any function to convert numbers like 099,129,009 to just 99,129 and 9? Quote Link to comment https://forums.phpfreaks.com/topic/240020-need-some-help-converting-number-formats/ Share on other sites More sharing options...
TeNDoLLA Posted June 21, 2011 Share Posted June 21, 2011 Does this help: http://fi2.php.net/manual/en/function.number-format.php ? Quote Link to comment https://forums.phpfreaks.com/topic/240020-need-some-help-converting-number-formats/#findComment-1232945 Share on other sites More sharing options...
gibigbig Posted June 21, 2011 Author Share Posted June 21, 2011 well not really, that is formatting decimals and stuff, not really what i want im looking for the opposite of sprintf Quote Link to comment https://forums.phpfreaks.com/topic/240020-need-some-help-converting-number-formats/#findComment-1232952 Share on other sites More sharing options...
fugix Posted June 21, 2011 Share Posted June 21, 2011 http://us3.php.net/manual/en/function.ltrim.php Quote Link to comment https://forums.phpfreaks.com/topic/240020-need-some-help-converting-number-formats/#findComment-1232953 Share on other sites More sharing options...
gibigbig Posted June 21, 2011 Author Share Posted June 21, 2011 figured it out, intval works. Quote Link to comment https://forums.phpfreaks.com/topic/240020-need-some-help-converting-number-formats/#findComment-1232955 Share on other sites More sharing options...
fugix Posted June 21, 2011 Share Posted June 21, 2011 I wouldn't recommend using intval unless your numbers are in string format. If they are in int format, leafing 0's csn cause unexpected results Quote Link to comment https://forums.phpfreaks.com/topic/240020-need-some-help-converting-number-formats/#findComment-1232982 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.