how can i check if a string is alphanumeric only if ctype functions do not work in my php version ?
alnum
ereg("[0-9a-zA-Z]",$variable)
is true if $variable only contains 0-9 or letters
michael kristopeit wrote:
ereg("[0-9a-zA-Z]",$variable)
is true if $variable only contains 0-9 or letters
no...it's true even when there is only one alphanumeric char...so that users can write 'as/"' and it checks true...i need a function that checks if all chars are alphanumeric
well then do this
!ereg("[0-9a-zA-Z]",$variable)