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.

Updated on: 2026-03-15T07:46:48+05:30

95 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements