Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2009
    Location
    Chicagoland
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Verify that a string is all alphanum and spaces

    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 ?

  • #2
    Regular Coder
    Join Date
    Apr 2009
    Location
    somewhere over the rainbow
    Posts
    105
    Thanks
    2
    Thanked 14 Times in 14 Posts

  • #3
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Well that's not exactly it. Non-alphanumeric and non-space does not automatically mean punctuation.

    Try
    PHP Code:
    ctype_alnum(str_replace(" """$string)); 


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •