Open In App

PHP | IntlChar::isJavaIDStart() Function

Last Updated : 04 Nov, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report

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
<?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(" $ "));
 
?>

Output: 

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


Program 2:

PHP
<?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));
}
?>

Output: 

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


Related Articles: 


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


Next Article
Article Tags :

Similar Reads