Cannot create php str_replace () to remove comma

In a PHP project, I have:

$string = "1,555"; str_replace(',', '', $string); echo $string; //is still 1,555 

str_replace does not remove the comma. If I var_dump. I get string(5) "1,555"

Any ideas? I just need to remove the commas so that I can calculate.

+6
source share
1 answer
 $string = str_replace(',', '', $string); 
+16
source

Source: https://habr.com/ru/post/920696/


All Articles