PHP | IntlChar::charMirror() Function

The IntlChar::charAge() function is an inbuilt function in PHP which is used to find the “mirror-image” character from the given input code point character, which maps the specified character.

Syntax:

mixed IntlChar::charMirror( $codepoint )

Parameters: This function accepts a single parameter $codepoint which is mandatory. The input parameter is a character or integer value, which is encoded as a UTF-8 string.

Return Value: This function returns another Unicode code point that may serve as a mirror-image substitute, or codepoint itself if there is no such mapping or codepoint does not have the Bidi_Mirrored property. The function returns an integer unless code point was passed in UTF-8 string and a string will be return.

Below programs illustrate the IntlChar::charMirror() Function in PHP.
Program 1:



filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP code to illustrate
// IntlChar::charMirror ()function
  
// Input Alphabet codepoint character
var_dump(IntlChar::charMirror("A"));
var_dump(IntlChar::charMirror("B"));
  
// Input codepoint is Symbloic 
var_dump(IntlChar::charMirror("&"));
var_dump(IntlChar::charMirror("{"));
var_dump(IntlChar::charMirror("^"));
var_dump(IntlChar::charMirror("]"));
  
// Input codepoint is integer 
var_dump(IntlChar::charMirror("2"));
var_dump(IntlChar::charMirror("10"));
  
?>

chevron_right


Output:

string(1) "A" 
string(1) "B" 
string(1) "&" 
string(1) "}" 
string(1) "^" 
string(1) "[" 
string(1) "2" 
NULL

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP code to illustrate
// IntlChar::charMirror() function
  
// Declare an array $arr
$arr = array("G", "Geek", "801", "7", "F", " \\", "/ ", "\t");
  
// Loop run for every array element
foreach ($arr as $val){
      
    // Check each element as code point data
    var_dump(IntlChar::charMirror($val));
}
?>

chevron_right


Output:

string(1) "G" 
NULL 
NULL 
string(1) "7" 
string(1) "F" 
NULL 
NULL 
string(1) "    " 

Related Articles:

Reference: http://php.net/manual/en/intlchar.charmirror.php




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : nidhi_biet

Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.