note 65376 deleted from function.htmlentities by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 16:57:03 +0000 |
| Subject: | note 65376 deleted from function.htmlentities by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154917@lists.php.net to get a copy of this message | ||
Note Submitter: soapergem at gmail dot com
----
Here's another version of that "allhtmlentities" function that an anonymous user
posted in the last comment, only this one would be significantly more efficient. Again, this would
convert anything that has an ASCII value higher than 127.
<?php
function allhtmlentities($string)
{
return preg_replace('/[^\x00-\x7F]/e',
'"&#".ord("$0").";"', $string);
}
?>