EchoFool Posted September 19, 2010 Share Posted September 19, 2010 Hey. I been using a function to check if a string contains only letters which is: ctype_alpha But i would like to change it to allow numbers 0 to 9 and the letters is there a function to do that in PHP i can't find it. Quote Link to comment https://forums.phpfreaks.com/topic/213820-check-string-is-numbers-and-letters-only/ Share on other sites More sharing options...
IwnfuM Posted September 19, 2010 Share Posted September 19, 2010 $checkValidetion = preg_match('/^[a-zA-Z0-9]+$/' , $string); $checkValidetion will equal 1 if is only chars and 0-9 and equals false 0 if there is something else. - Iwnfum. Quote Link to comment https://forums.phpfreaks.com/topic/213820-check-string-is-numbers-and-letters-only/#findComment-1112837 Share on other sites More sharing options...
sasa Posted September 19, 2010 Share Posted September 19, 2010 ctype_alnum() Quote Link to comment https://forums.phpfreaks.com/topic/213820-check-string-is-numbers-and-letters-only/#findComment-1112838 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.