PHP | ctype_punct() Function Last Updated : 25 Jun, 2018 Comments Improve Suggest changes Like Article Like Report The ctype_punct() is an inbuilt function in PHP which is used to check printable character which is not whitespace or an alphanumeric character. Every character in a string is printable, but neither alphanumeric, digit or blank then return True otherwise return False. Syntax: bool ctype_punct ( $text ) Parameters: This function accepts a single parameter $text. It is a mandatory parameter which specifies the string. Return Value: It returns True if string does not contain any alphanumeric, digit or blank character and False on failure. Examples: Input : GeeksforGeeks Output : No Explanation: String (GeeksforGeeks) contains only the alphanumeric characters. Input : $%^&@ Output : Yes Explanation: String ($%^&@) contains only the punctuation character. Below programs illustrate the ctype_punct() function. Program 1: php <?php // PHP program to check the given // string is not containing any // alphanumeric or digit or blank // character $string1 = 'GeeksforGeeks'; if ( ctype_punct($string1)) echo "Yes\n"; else echo "No\n"; $string2 = '$%^&@'; if ( ctype_punct($string2)) echo "Yes\n"; else echo "No\n"; ?> Output: No Yes Program 2: Code for ctype_punct() function accepts input array of string which contains integers and special Symbol. php <?php // PHP program to check given // string is not contain any // alphanumeric or digit or // blank character $strings = array ( 'Geeks', 'Geeks space', '@@##-- /', '12345', '\n', '&%@!()^' ); // Checking above given strings // by used of ctype_punct() // function . foreach ($strings as $test) { if (ctype_punct($test)) echo "Yes\n"; else echo "No\n"; } ?> Output: No No No No No Yes Reference: http://php.net/manual/en/function.ctype-punct.php Comment More infoAdvertise with us Next Article PHP | ctype_punct() Function M Mithun Kumar Follow Improve Article Tags : Misc Web Technologies PHP PHP-function Practice Tags : Misc Similar Reads PHP | ctype_punct() Function The ctype_punct() function in PHP is used to check if all of the characters of a given string are punctuation characters or not. If all characters are punctuation characters then this function return TRUE, otherwise, returns FALSE. Note: The punctuation characters are, period, comma, question mark, 2 min read PHP | ctype_print() Function The ctype_print() Function in PHP used to check each and every character of a string are visible or not. If all characters of string are visible then returns TRUE , else if there are any control character then return FALSE. Control Character: A character that does not represent a printable character 2 min read PHP | ctype_space() Function A ctype_space() function in PHP is used to check whether each and every character of a string is whitespace character or not. It returns True if the all characters are white space, else returns False. Syntax : ctype_space(string text) Parameter Used: text :- It is a mandatory parameter which specifi 2 min read PHP | ctype_upper() Function The ctype_upper() function in PHP used to check each and every character of a given string is in uppercase or not. If the string in upper case then it returns TRUE otherwise returns False. Syntax: ctype_upper (string text) Parameter Used:- $text : The tested string. Return Value: Function returns Tr 2 min read PHP | ctype_xdigit() Function The ctype_xdigit() function in PHP used to check each and every character of string/text are hexadecimal digit or not. It return TRUE if all characters are hexadecimal otherwise return FALSE . Syntax : ctype_xdigit(string text) Parameters Used: text : It is mandatory parameter which specifies the te 2 min read PHP | ctype_graph() Function A ctype_graph() Function is inbuilt function in PHP. The given string is used to check each character and display all visible character without white-space character. If it's visible then return True otherwise False. Syntax: bool ctype_graph ( $text ) Parameters: The ctype_graph() function accepts a 2 min read PHP | ctype_cntrl() Function The ctype_cntrl() is an inbuilt function in PHP which is used to check all the characters in string/text are control characters. Control characters are e.g. line feed, tab, escape.Syntax: bool ctype_cntrl ( $str ) Parameters: This function accepts a single parameter $str. It is a mandatory parameter 2 min read PHP | ctype_cntrl() Function The ctype_cntrl() function is an inbuilt function in PHP and is used to check if all the characters of a given string are control characters or not. It returns True if all characters of the string are control characters otherwise it returns false.Control Character: A character that does not represen 2 min read PHP | ctype_lower() Function The ctype_lower() function is an inbuilt function in PHP which is used to check whether the given characters in the string is lower case or not. Syntax: bool ctype_lower( string $text ) Parameters: This function accepts single parameter $text which holds the string that need to be tested. Return Val 1 min read PHP ucfirst() Function The ucfirst() function is a built-in function in PHP which takes a string as an argument and returns the string with the first character in Upper Case and all other characters remain unchanged. Syntax: ucfirst($string) Parameter: The function accepts only one parameter $string which is mandatory. Th 2 min read Like