phpretard Posted April 3, 2009 Share Posted April 3, 2009 If a user decides to properly format a dollar amount such as: $200,000.00 I need to insert it like this: 200000 I need to take out the $ and , and .00 I am not sure... Any Help? Quote Link to comment https://forums.phpfreaks.com/topic/152474-solved-easy-money-format-question/ Share on other sites More sharing options...
Maq Posted April 3, 2009 Share Posted April 3, 2009 Why are you taking out the .00? Are you rounding the amount to the nearest dollar? Quote Link to comment https://forums.phpfreaks.com/topic/152474-solved-easy-money-format-question/#findComment-800763 Share on other sites More sharing options...
phpretard Posted April 3, 2009 Author Share Posted April 3, 2009 In this atmosphere the there should be no change (.00). I just need it to be a number without the .00 Quote Link to comment https://forums.phpfreaks.com/topic/152474-solved-easy-money-format-question/#findComment-800767 Share on other sites More sharing options...
phpretard Posted April 3, 2009 Author Share Posted April 3, 2009 In the Mortgage Industry the change is not certain until closing so, typically the Loan Officer will not include it Quote Link to comment https://forums.phpfreaks.com/topic/152474-solved-easy-money-format-question/#findComment-800774 Share on other sites More sharing options...
Maq Posted April 3, 2009 Share Posted April 3, 2009 There's probably an easier way but with regex you can filter out whatever you need. Hope this helps: $s = "$200,000.00"; echo preg_replace("/[$ ,]|\.[0-9]{2}/", "", $s); Quote Link to comment https://forums.phpfreaks.com/topic/152474-solved-easy-money-format-question/#findComment-800777 Share on other sites More sharing options...
phpretard Posted April 4, 2009 Author Share Posted April 4, 2009 Thanks a $200K Anthony! Quote Link to comment https://forums.phpfreaks.com/topic/152474-solved-easy-money-format-question/#findComment-801117 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.