note 27988 rejected from function.html-entity-decode by nicos
| From: | nicos@php.net | Date: | Sun, 29 Dec 2002 01:36:41 +0000 |
| Subject: | note 27988 rejected from function.html-entity-decode by nicos | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-41405@lists.php.net to get a copy of this message | ||
The following code will NOT work as expected:
$string = " foobar ";
$string = html_entity_decode($string);
echo "<pre>" . trim($string) . "</pre>";
Why? Because html_entity_decode replaces with 0xa0 and not 0x20 which is the one being
removed with trim(). As a result of this, you must use the following code instead:
echo "<pre>" . trim($string,"\xa0") . "</pre>";