slyte33 Posted February 28, 2010 Share Posted February 28, 2010 Hello, I am making a new mmorpg game and I was curious if it is possible to use commas in textboxes, and then when submitting the data, strip the commas and submit. This way, if a player has... $1,000,000 and they want to deposit it in their bank, they could simply enter 1,000,000 and not 1000000. I hope this explains it, and help is much appreciated. Thanks, Slyte Quote Link to comment Share on other sites More sharing options...
inversesoft123 Posted February 28, 2010 Share Posted February 28, 2010 $richman = "10,00000,000000,000000"; $richman = str_replace(",","",$richman); echo "$richman"; Quote Link to comment Share on other sites More sharing options...
slyte33 Posted February 28, 2010 Author Share Posted February 28, 2010 Works perfect, thanks! Quote Link to comment Share on other sites More sharing options...
alpine Posted February 28, 2010 Share Posted February 28, 2010 You should probably also convert periods (.) and dont rely on everyone using commas In addition i would remove whitespace etc. $text = trim(str_replace(array(",","."), "", $text)); 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.