Drew wrote: > When I run the following script it returns String Okay! when it should say > Invalid Characters Found. I've tried the script substituting $ for other > characters, such as j, and it works just fine. What do I need to do? > > <?php > > $input = "johnon@company.$com"; > > if (ereg("[$]", $input)) { > die("Invalid Characters Found."); > } elseif (ereg("[[:space:]]", $input)) { > die("Whitespace found."); > } else { > echo "String okay!"; > } > > ?> > > Thanks, > > Drew
Try changing the double quotes to single quotes i.e. $input = 'johnon@company.$com'; php automatically attempts variable substitution on double-quoted strings, but not single-quoted strings. Unless you know that you want variable substitution, it's always safer and faster to use single-quotes. George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php