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. 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. 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() 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
Archived
This topic is now archived and is closed to further replies.