I have a string which contains a price inside.
I need to remove the decimal part and currency part of that.
The currency symbol can be removed by PHP using the str_replace()
function, but the decimal part varies from product to product.
<span class="price" id="old-price-3">€ 200,00 </span>
<span class="price" id="product-price-3">€ 80,00</span>
I need this like:
<span class="price" id="old-price-3">200 </span>
<span class="price" id="product-price-3">80</span>
I tried str_replace()
:
echo str_replace(array(',00','€'),'','<span class="price" id="old-price-3">200 </span>
<span class="price" id="product-price-3">80</span>');
But this only works when there are 00
decimals. Can someone help me with this?