|
|
match strings using ctype functions in php - PHP
|
Views : 180
|
|
Tagged in : PHP
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Hi,
We use preg_match in php to match the string is in particular format. There is note in php manual which says that "preg_match" funtion works slow.
But php has some inbuilt functions which works similar to preg_match concepts.
To check the given string consists only string and number we can use "ctype_alnum" function.For example,
$word="hiox";
if(ctype_alnum($word))
echo "contains only alpha numeric characters";
else
echo "it contains non alphanumerica characters also";
There are some more ctype functions like ctype_digit etc.,
|
|
By Guna, On - 2011-10-11 |
|
|
|