papaface Posted September 26, 2007 Share Posted September 26, 2007 Hello, How do I check if a string contains letters only. So the string should only contain normal letters such as a b c d, and not letters like é á ú ó etc? regards Link to comment https://forums.phpfreaks.com/topic/70778-solved-check-if-a-string-contains-letters-only/ Share on other sites More sharing options...
GingerRobot Posted September 26, 2007 Share Posted September 26, 2007 You'll want regular expressions: <?php $str = 'é'; if(!eregi('^[A-Z]+$',$str)){ echo 'bad string'; }else{ echo 'good string'; } ?> Link to comment https://forums.phpfreaks.com/topic/70778-solved-check-if-a-string-contains-letters-only/#findComment-355872 Share on other sites More sharing options...
papaface Posted September 26, 2007 Author Share Posted September 26, 2007 Thanks, works Link to comment https://forums.phpfreaks.com/topic/70778-solved-check-if-a-string-contains-letters-only/#findComment-355959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.