note 65954 deleted from function.htmlentities by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 16:56:56 +0000 |
| Subject: | note 65954 deleted from function.htmlentities by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154916@lists.php.net to get a copy of this message | ||
Note Submitter: soapergem at gmail dot com
----
A quick revision to my last comment. For some reason, leaving the control characters in the safe
range seemed to screw things up. So instead, using this function will do what everybody else here is
trying to do, but it will do so in a single line:
<?php
$text = preg_replace('/[^\x09\x0A\x0D\x20-\x7F]/e',
'"&#".ord($0).";"', $text);
?>