PHP | IntlChar::charMirror() Function
The IntlChar::charMirror() 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 the 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 returned.
Below programs illustrate the IntlChar::charMirror() Function in PHP.
Program 1:
<?php
var_dump(IntlChar::charMirror( "A" ));
var_dump(IntlChar::charMirror( "B" ));
var_dump(IntlChar::charMirror( "&" ));
var_dump(IntlChar::charMirror( "{" ));
var_dump(IntlChar::charMirror( "^" ));
var_dump(IntlChar::charMirror( "]" ));
var_dump(IntlChar::charMirror( "2" ));
var_dump(IntlChar::charMirror( "10" ));
?>
|
Output:
string(1) "A"
string(1) "B"
string(1) "&"
string(1) "}"
string(1) "^"
string(1) "["
string(1) "2"
NULL
Program 2:
<?php
$arr = array ( "G" , "Geek" , "801" , "7" , "F" , " \\" , "/ " , "\t" );
foreach ( $arr as $val ){
var_dump(IntlChar::charMirror( $val ));
}
?>
|
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
Last Updated :
03 Nov, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...