note 27988 added to function.html-entity-decode

From: Date: Sat, 28 Dec 2002 18:53:03 +0000
Subject: note 27988 added to function.html-entity-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-41392@lists.php.net to get a copy of this message
The following code will NOT work as expected: $string = "&nbsp;&nbsp;&nbsp;foobar&nbsp;&nbsp;&nbsp;"; $string = html_entity_decode($string); echo "<pre>" . trim($string) . "</pre>"; Why? Because html_entity_decode replaces &nbsp; 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>"; -- http://www.php.net/manual/en/function.html-entity-decode.php http://master.php.net/manage/user-notes.php?action=edit+27988 http://master.php.net/manage/user-notes.php?action=delete+27988 http://master.php.net/manage/user-notes.php?action=reject+27988

« previous php.notes (#41392) next »