I am Parsing a web page for getting the web page prize. the prize include a Rupee symbol (₹).
So i used preg_replace to extract digits.
For example:
$str='₹ 1,195 ';
echo preg_replace("/[^0-9]/", '', $str);
Output is :
2091195
I tried same code to execute on http://writecodeonline.com/php/.
There i m getting correct output 1195.
I’m not getting what is the problem.
Thanks in Advance
If the unicode string is UTF-8, you can use the u (PCRE_UTF8) modifierDocs to tell
preg_replacethat it should use UTF-8 mode. If not, re-encode it to UTF-8 first and then use the modifier.Example (Demo):