i have two strings in a php i want to make following checks in that
1) 4f74adce2a4d2 - contains ***alphanumerics***
2) getAllInfo - contains ***only alphabetic***
to check this i wrote a function but whatever value $pk contains among above , results into
true only , but i want to differentiate between alphanumeric and alphabetic only
<?php
if (ereg('[A-Za-z^0-9]', $pk)) {
return true;
} else if (ereg('[A-Za-z0-9]', $pk)) {
return false;
}
?>
Use the following two functions to detect whether a variable is alhpanumeric or alphabetic:
Visit this link for the reference guide: http://php.net/manual/en/book.ctype.php