Jump to content

str_replace problem


c_pattle

Recommended Posts

When getting data from a database I'm trying to use the str_replace function to get rid of any pound signs but it doesn't seem to be working.  My code is below. 

 

str_replace("£", "", $array['product_price'])

 

I've also tried replace "£" with "£" but that doesn't work either.  Does anyone know why that's happening?

 

Thanks for any help. 

 

 

Link to comment
https://forums.phpfreaks.com/topic/247727-str_replace-problem/
Share on other sites

I checked and it is stored in the same field.  Also if I try to use the same code on a post variable so that I remove the "£" before it gets entered into the database it still doesn't seem to remove it.  So if I did the following it doesn't work. 

 

$products->product_price = str_replace("£", "", $_POST['product-price']);

Link to comment
https://forums.phpfreaks.com/topic/247727-str_replace-problem/#findComment-1272171
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.