I have the following doubt, I have to add a set of values that are set to string's
, so I had to convert to float
, I used the function str_replace()
, except that when testing the variable with var_dump
and perform the sum in a function that runs a array
with the objects of the variables, I noticed that the original value, in case R $ 4,200.00, was converted to (4,2) literally.
How do I resolve this issue? Because I need to add the value of 4,200.00. The output on the web is as follows:
1 Microsoft Optical Mouse R $ 89,90 Peripherals
2 HP LaserJet 1320 Printer - Compare Prices and Buy at PriceGrabber 3 Macbook Pro Apple R $ 4,200.00 Notebooks
4 Wireless Keyboard Genius R $ 110,00 Peripherals
5 Lenovo Computer R $ 2.100,00 Computers89.90float (89.9)
850.00float (850)
4.200.00float (4.2)