Home >Backend Development >PHP Tutorial >How to Represent a Unicode Character Using Its Codepoint in PHP?
Unicode Character Representation in PHP Strings
In this PHP programming question, we seek to create a string containing a single Unicode character with a known Unicode numeric value. Specifically, we aim to find the PHP equivalent of the C# code:
string str = "\u1000";
Solution
With the introduction of PHP 7.0.0, we can leverage the Unicode codepoint escape syntax to effortlessly create strings containing Unicode characters:
$unicodeChar = "\u{1000}";
This syntax allows us to specify Unicode characters using a double-quoted string or a heredoc string without the need for additional functions or complex character encoding.
The above is the detailed content of How to Represent a Unicode Character Using Its Codepoint in PHP?. For more information, please follow other related articles on the PHP Chinese website!