c_pattle Posted June 11, 2010 Share Posted June 11, 2010 Hey. I have a variable that stores the overall total of a shopping cart so for example it's currently 22.50. Is there anyway I can split this variable as I want a seperate one for pounds and a seperate one for pence? Thanks Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted June 11, 2010 Share Posted June 11, 2010 Like explode list($pounds, $pence) = explode(".", $cost); Quote Link to comment Share on other sites More sharing options...
c_pattle Posted June 11, 2010 Author Share Posted June 11, 2010 Thanks, also is there a way you can make a variable display to a certain number of decimal places because at the moment £15.50 only displays as 15.5? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted June 11, 2010 Share Posted June 11, 2010 You can bet your bottom dollar there is. number_format You should probably try Googling first, I'm fairly sure it'd turn up. 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.