0

How do I convert \u20B9 to the symbol in PHP?

I tried utf8_decode() but it is returning the same string.

Xorifelse
  • 7,878
  • 1
  • 27
  • 38
Codeformer
  • 2,060
  • 9
  • 28
  • 46

1 Answers1

1

You can use json_decode method because JSON directly supports the \uxxxx syntax

$unicodeChar = '\u20B9';
echo json_decode('"'.$unicodeChar.'"');

For more reference try this link - http://php.net/manual/en/function.json-decode.php

Manthan Dave
  • 2,137
  • 2
  • 17
  • 31