gorgo Posted December 7, 2008 Share Posted December 7, 2008 I want to verify that a string only contains letters, numbers, and spaces. How could I do this? Thanks. Link to comment https://forums.phpfreaks.com/topic/135928-letters-numbers-and-spaces-only/ Share on other sites More sharing options...
john-formby Posted December 7, 2008 Share Posted December 7, 2008 Something like: preg_match('/^[a-z0-9]+$/i', $string) Link to comment https://forums.phpfreaks.com/topic/135928-letters-numbers-and-spaces-only/#findComment-708557 Share on other sites More sharing options...
gevans Posted December 7, 2008 Share Posted December 7, 2008 <?php function stringCheck($n){ if(!ereg("^[a-zA-Z0-9 ]+$", $n)) return false; else return true; } ?> Link to comment https://forums.phpfreaks.com/topic/135928-letters-numbers-and-spaces-only/#findComment-708560 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.