Friday, August 29, 2025
HomeLanguagesPHP | IntlChar isgraph() Function

PHP | IntlChar isgraph() Function

The IntlChar::isgraph() function is an inbuilt function in PHP which is used to check the code point is a graphic character or not. It returns True for all characters except those with general categories Cc(control codes), Cf(format controls), Cs(surrogates), Cn(unassigned), and Z(separators).

Syntax:

bool IntlChar::isgraph ( $codepoint )

Parameters: This function accepts a 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 True if $codepoint is a graphic character, False otherwise.

Below programs illustrate the IntlChar::isgraph() function in PHP:

Program 1:




<?php
  
// PHP code to illustrate the 
// IntlChar::isgraph() function.
  
// Alphabet cases 
var_dump(IntlChar::isgraph("c"));
  
// Single digit
var_dump(IntlChar::isgraph("4"));
  
// UTF encoded string
var_dump(IntlChar::isgraph("\u{2403}"));
  
// new line character
var_dump(IntlChar::isgraph("\n"));
  
// vertical tab character
var_dump(IntlChar::isgraph("\t"));
?>


Output:

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

Program 2:




<?php
// PHP code to illustrate IntlChar isgraph()
     
// Declare an array $arr
$arr = array("Z", "291", "^", "  ", "*", "Sudo Placement");
    
// Loop run for every array element
foreach ($arr as $val){
        
    // Check each element as code point data
    var_dump(IntlChar::isgraph($val));
}
?>


Output:

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

Related Articles:

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

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32249 POSTS0 COMMENTS
Milvus
80 POSTS0 COMMENTS
Nango Kala
6617 POSTS0 COMMENTS
Nicole Veronica
11791 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11838 POSTS0 COMMENTS
Shaida Kate Naidoo
6731 POSTS0 COMMENTS
Ted Musemwa
7012 POSTS0 COMMENTS
Thapelo Manthata
6689 POSTS0 COMMENTS
Umr Jansen
6701 POSTS0 COMMENTS