PHP | IntlChar::isJavaIDStart() Function

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 a single parameter $codepoint which is mandatory. The input parameter $codepoint is a character or integer 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

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP function to illustrate the
// use of IntlChar::isJavaIDStart()
    
// Input string codepoint value with
// Capital and small letter
var_dump(IntlChar::isJavaIDStart("R"));
 
// Input string codepoint value with small character
var_dump(IntlChar::isJavaIDStart("r"));
 
// Input control character codepoint value
var_dump(IntlChar::isJavaIDStart("\n"));
   
// Input string codepoint value
var_dump(IntlChar::isJavaIDStart("Bug"));
    
// Input int codepoint value
var_dump(IntlChar::isJavaIDStart("3 "));
  
// Input int char an identifier
// of codepoint value
var_dump(IntlChar::isJavaIDStart("\u{007F}"));
   
// Input symbolic codepoint value
var_dump(IntlChar::isJavaIDStart(" @ "));
var_dump(IntlChar::isJavaIDStart(" $ "));
  
?>

chevron_right


Output: 

bool(true)
bool(true)
bool(false)
NULL
NULL
bool(false)
NULL
NULL

Program 2:

PHP

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP function to illustrate the
// use of IntlChar::isJavaIDStart()
  
// Declare an array with
// different codepoint value
$arr = array("C",
             " ",
             "\n",
             " #",
             "\t",
             "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));
}
?>

chevron_right


Output: 

bool(true)
bool(false)
bool(false)
NULL
bool(false)
NULL

Related Articles: 

Reference: http://php.net/manual/en/intlchar.isjavaidstart.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 : arorakashish0911

Article Tags :

Be the First to upvote.


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