PHP | IntlChar getBidiPairedBracket() Function
Last Updated :
27 Aug, 2019
The IntlChar::getBidiPairedBracket() function is an inbuilt function in PHP which is used to get the paired bracket character for a code point. This function mapped with paired bracket. If the character has no pair bracket then it returns the character itself.
Syntax:
IntlChar::getBidiPairedBracket ( $codepoint )
Parameters: This function accepts single parameter $codepoint which is mandatory. The $codepoint value is an integer values or character, which is encoded as a UTF-8 string.
Return Value: This function returns the mapped paired bracket. If the character has no pair bracket then it returns the character itself.
Below programs illustrate the IntlChar::getBidiPairedBracket() function in PHP:
Program 1:
<?php
var_dump(IntlChar::getBidiPairedBracket(91));
var_dump(IntlChar::getBidiPairedBracket( '[' ));
var_dump(IntlChar::getBidiPairedBracket( '}' ));
var_dump(IntlChar::getBidiPairedBracket( '"' ));
var_dump(IntlChar::getBidiPairedBracket( 'ABC' ));
var_dump(IntlChar::getBidiPairedBracket( 'A' ));
?>
|
Output:
int(93)
string(1) "]"
string(1) "{"
string(1) """
NULL
string(1) "A"
Program 2:
<?php
$arr = array ( "G" , "{" , "^" , ")" , "6" , "{}" , "))" , "\t" );
foreach ( $arr as $val ){
var_dump(IntlChar::getBidiPairedBracket( $val ));
}
?>
|
Output:
string(1) "G"
string(1) "}"
string(1) "^"
string(1) "("
string(1) "6"
NULL
NULL
string(1) " "
Related Articles:
Reference: http://php.net/manual/en/intlchar.getbidipairedbracket.php
Share your thoughts in the comments
Please Login to comment...