The IntlChar::isJavaIDStart() function is an inbuilt function in PHP which is used to check whether the input character code point is permissible since the first character is a java identifier or not. It is True for characters with general category “Sc” (Currency Symbols), and “Pc” (Connecting Punctuation).
Syntax:
bool IntlChar::isJavaIDStart( $codepoint )
Parameters: This function accepts single parameter $codepoint which is mendatory. The input parameter $codepoint is a character or interger value, which is encoded as a UTF-8 string.
Return Value: Returns True, if $codepoint start with Java identifier character, otherwise return False.
Below programs illustrate the IntlChar::isJavaIDStart() function in PHP:
Program 1:
<?php // PHP function to illustrate the // use of IntlChar::isJavaIDStart() // Input string codepoint value with // Capital and small letter var_dump(IntlChar::isJavaIDStart( "R" )); echo "<br>" ; // Input string codepoint value with small character var_dump(IntlChar::isJavaIDStart( "r" )); echo "<br>" ; // Input control character codepoint value var_dump(IntlChar::isJavaIDStart( "
" )); echo "<br>" ; // Input string codepoint value var_dump(IntlChar::isJavaIDStart( "Bug" )); echo "<br>" ; // Input int codepoint value var_dump(IntlChar::isJavaIDStart( "3 " )); echo "<br>" ; // Input int char an identifier // of codepoint value var_dump(IntlChar::isJavaIDStart( "u{007F}" )); echo "<br>" ; // Input symbolic codepoint value var_dump(IntlChar::isJavaIDStart( " @ " )); echo "<br>" ; var_dump(IntlChar::isJavaIDStart( " $ " )); echo "<br>" ; ?> |
Output:
bool(true) bool(true) bool(false) NULL NULL bool(false) NULL NULL
Program 2:
<?php // PHP function to illustrate the // use of IntlChar::isJavaIDPart() // Declare an array with // different codepoint value $arr = array ( "C" , " " , "
" , " #" , " " , "Code" , ); // For loop condition to check // each character through function foreach ( $arr as $val ) { // Check each element as code point data var_dump(IntlChar::isJavaIDStart( $val )); echo "<br>" ; } ?> |
Output:
bool(true) bool(false) bool(false) NULL bool(false) NULL
Related Articles:
- IntlChar::isIDIgnorable() Function
- IntlChar::isIDStart() Function
- IntlChar::isIDPart() Function
- IntlChar::isISOControl() Function
Reference: http://php.net/manual/en/intlchar.isjavaidstart.php
leave a comment
0 Comments