Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
IntlChar isMirrored() function in PHP
The IntlChar::isMirrored() function is used to check whether a character has the Bidi_Mirrored property, which indicates if the character is mirrored in bidirectional text (like Arabic or Hebrew).
Syntax
bool IntlChar::isMirrored(mixed $codepoint)
Parameters
codepoint − An integer codepoint value or a character encoded as a UTF-8 string.
Return Value
Returns TRUE if the character has the Bidi_Mirrored property, FALSE otherwise.
Example
The following example demonstrates checking various characters for the Bidi_Mirrored property −
<?php
var_dump(IntlChar::isMirrored("<"));
echo "<br>";
var_dump(IntlChar::isMirrored(">"));
echo "<br>";
var_dump(IntlChar::isMirrored("p"));
echo "<br>";
var_dump(IntlChar::isMirrored("*"));
echo "<br>";
var_dump(IntlChar::isMirrored("("));
echo "<br>";
var_dump(IntlChar::isMirrored(")"));
?>
Output
bool(true) bool(true) bool(false) bool(false) bool(true) bool(true)
How It Works
Characters with the Bidi_Mirrored property include brackets, parentheses, and mathematical operators that need to be visually mirrored when text direction changes. For example, "" in right-to-left text.
Conclusion
The IntlChar::isMirrored() function is useful for internationalization when working with bidirectional text layouts. It helps identify characters that need visual mirroring in RTL languages.
