ctype_cntrl(): to check control characters

Check control characters with ctype_cntrl()

ctype_cntrl() checks whether every character in a string is a control character. It is mainly useful when inspecting low-level text data.

$value = "\n\t";
var_dump(ctype_cntrl($value));
$var="\n\e\t\v";
if(ctype_cntrl($var)){
echo " All are control characters ";
}else{ 
echo "All or some are not control characters ";
}
Output is here
All are control characters
Syntax
bool ctype_cntrl ( string $input_string )
$input_string : String to be checked.

ctype_cntrl() is a PHP filter function checks if all chars in the $input_string are control characters or not. Any thing other than this if present then it return FALSE.

Control characters are non-printing chars that does not represents a written symbol. Example : \n ( line feed ) , \e escape, \v vertical tab etc..


ctype() ctype_alpha(): alphabetic characters only ctype_alnum(): alphanumeric characters only



Subscribe to our YouTube Channel here



plus2net.com











PHP video Tutorials
✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer