Converting complex characters
The ability to access the entire Unicode character set opens up many new possibilities for rendering complex characters, especially characters in alphabets other than Latin-1.
How to do it...
- Some languages are read right-to-left instead of left-to-right. Examples include Hebrew and Arabic. In this example, we show you how to present reverse text using the
U+202E
Unicode character for right-to-left override. The following line of code printstxet desreveR
:echo "\u{202E}Reversed text"; echo "\u{202D}"; // returns output to left-to-right
Note
Don't forget to invoke the left-to-right override character,
U+202D
, when finished! - Another consideration is the use of composed characters. One such example is
ñ
(the lettern
with ...
Get PHP 7 Programming Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.