jwk811 Posted December 1, 2006 Share Posted December 1, 2006 how can i find out if a number is in number format? like 1,000,000.. i would need to get rid of the commas so i could do the math.. so see if it has commas then get rid of them if it does. Quote Link to comment https://forums.phpfreaks.com/topic/29055-number-format-identify-commas-and-remove-how/ Share on other sites More sharing options...
ToonMariner Posted December 1, 2006 Share Posted December 1, 2006 you could just let the automagic happen or force the data type with (int) or (float) 1,000,000 Quote Link to comment https://forums.phpfreaks.com/topic/29055-number-format-identify-commas-and-remove-how/#findComment-133117 Share on other sites More sharing options...
btherl Posted December 1, 2006 Share Posted December 1, 2006 You could do [code=php:0]$num = str_replace(',', '', $num);[/code]. Then it's definitely got no commas :) Quote Link to comment https://forums.phpfreaks.com/topic/29055-number-format-identify-commas-and-remove-how/#findComment-133118 Share on other sites More sharing options...
jwk811 Posted December 1, 2006 Author Share Posted December 1, 2006 sweeet.. thank you Quote Link to comment https://forums.phpfreaks.com/topic/29055-number-format-identify-commas-and-remove-how/#findComment-133611 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.