I am working on one of the ecommerce project in OScommerce and I have to implement google tracking in it, Google doesn't allows product price with currency symbol as a parameter in it's method . but on my payment success page I got product price with the currency symbol. So, is there any way through which we extract numeric value from product price.
Asked
Active
Viewed 196 times
1 Answers
2
Try:
$price_no_curr = preg_replace ( '#\D*?(\d+(\.\d+)?)\D*#', '$1', $price);

Wayne Whitty
- 19,513
- 7
- 44
- 66
-
An explanation of how it works would make this answer better. This type of answer tends to fosters copy and paste coders. – frederickjh Aug 15 '19 at 12:36