I take data from steam and this is what I get outputed
{"success":true,"lowest_price":"$0.82","volume":"17,485","median_price":"$0.82"}
So I want to take the data to mysql database and with lowest_price and medain_price I can just do it like that
$filename_median_price = "https://steamcommunity.com/market/priceoverview/?appid=730¤cy=1&market_hash_name=Operation%20Breakout%20Weapon%20Case"; $data_median_price = file_get_contents($filename_median_price); $array_median_price = json_decode($data_median_price, true); $median_price1 = $array_median_price["median_price"]; $median_price = strtr("$median_price1","$"," ");
and then update it to the data base.
But with volume I can’t because there is a comma instead of a dot and in the database it only updates me to 17 instead of 17485. So how can I remove the comma so I can update data properly.
Advertisement
Answer
You can simply replace the comma for a period and cast it to a type you desire, you can read more on this here
(float)str_replace(',', '.', '123,456')