Scripts.com - Get the best scripts NOW!
HotScripts.com - Over 10 web rings.
more links...
    
Index    News    Downloads    E-Mail me    Forum  
    

VALIDATE-STRING.PHP

I wrote this function to intercept strings that would not make good user names due to the presence of invalid url characters. If the string contains no invalid characters, the function returns true, if it does, it either returns false or a formatted string containing all the invalid characters. The return value should be tested using the === or !== operators, because true and any non empty string are both treated as true when using == or !=.



The second parameter, $return_invalid_chars, determines what happens when a string fails the test. If it is set to true, it returns a string, otherwise it will return false. If omitted, the default value for $return_invalid_chars is false.