Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove dots from numbers?

I have a form formatted with javascript, which makes numbers look like:

10.000 or 2.300

<form>
<input type="text" name="price_1" value="2.300">
</form>

But i want to store them in mysql without dots. How to remove them?

mysql_query("INSERT INTO prices price_a='price_1' WHERE id ='price_id'");

I see money_format and number_format, but its just format the numbers dont remove anything.

like image 709
Simulator88 Avatar asked Jan 28 '13 08:01

Simulator88


1 Answers

Try this :

str_replace(".", "", $string);
like image 116
Prasanth Bendra Avatar answered Sep 20 '22 14:09

Prasanth Bendra