View Full Version : Verify that a string is all alphanum and spaces
04-30-2009, 10:50 PM
I'm looking for a PHP function that would return TRUE for a string of alphanumeric characters and spaces and FALSE if there were any characters that were neither alphanum nor spaces.
Any ideas ?
05-01-2009, 04:22 AM
Well that's not exactly it. Non-alphanumeric and non-space does not automatically mean punctuation.
ctype_alnum(str_replace(" ", "", $string));
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.