Is there any way you can convert "185,345,321" to 185345321 by using PHP?
2
-
By removing the commas?Brian– Brian2013-10-15 19:26:05 +00:00Commented Oct 15, 2013 at 19:26
-
This is a good question. If you try to convert "1,096" using (int) or intval, the result will be 1.stealthysnacks– stealthysnacks2016-10-12 20:45:45 +00:00Commented Oct 12, 2016 at 20:45
Add a comment
|
8 Answers
Yes, use str_replace()
Example:
str_replace( ",", "", "123,456,789");
Live example: http://ideone.com/Q7IAIN