A ctype_alpha() function in PHP used to check all characters of a given string are alphabetic or not. If all characters are alphabetic then return True otherwise return False.
- $text :- It is a mandatory parameter which specifies the string.
It returns True if all characters of string are alphabets and a False on failure.
Input : GeeksforGeeks Output : Yes Explanation : String (GeeksforGeeks) contains only alphabets Input : GFG-GCET-2018 Output : No Explanation : String contains Integer and special characters. Note: Except string ,if you input anything then it will return FALSE.
Below programs illustrate the ctype_alpha() function.
Program : 2 Drive a code ctype_alpha() function where input an array of string which contains integers and special characters.
Yes No No No No
- PHP | ctype_digit() (Checks for numeric value)
- How to get all alphabetic chars in an array in PHP ?
- How to push a value based on matched value in PHP ?
- How to get hex color value of RGB value ?
- How to change an element color based on value of the color picker value using onclick?
- PHP | Print the last value of an array without affecting the pointer
- PHP | Program to move (key,value) pair upwards or downwards
- PHP | Spreadsheet | Setting a cell value by coordinate
- PHP | Spreadsheet | Setting a date and/or time value in a cell
- PHP multidimensional array search by value
- How to search by key=>value in a multidimensional array in PHP ?
- How to get random value out of an array in PHP?
- Comparing float value in PHP
- How to search by multiple key => value in PHP array ?
- How to determine if an array contains a specific value in PHP?
- How to merge the duplicate value in multidimensional array in PHP ?
- How to remove a key and its value from an associative array in PHP ?
- How to create an array with key value pairs in PHP?
- PHP 5 vs PHP 7
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.