note 46308 deleted from function.addslashes by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 06 Oct 2004 18:07:00 +0000 |
| Subject: | note 46308 deleted from function.addslashes by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-78077@lists.php.net to get a copy of this message | ||
Note Submitter: chad at onebearcat dot com
----
Another solution to Mark's problem below is to use the built in htmlentities(...) function that
converts HTML special chars to their HTML entity codes (ie., " to "). This way you are
also avoiding any other problems you may run into in the future with say single quotes or ampersands
- both of which are converted to their HTML codes with this function.
$str = "This is a \"test\" string.";
htmlentities($str, ENT_QUOTES);
echo $str; //This is a "test" string