note 26364 deleted from function.include by sniper
| From: | sniper@php.net | Date: | Wed, 29 Jan 2003 04:16:34 +0000 |
| Subject: | note 26364 deleted from function.include by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42997@lists.php.net to get a copy of this message | ||
The prior trim suggestion only removes nulls at the end of the string. If the string contains a
null in the middle, it will not be detected and removed. Only the nulls and whitespace at the end or
beginning will be removed.
Also, there are times when you might want to keep the white space.
One work-around is to create a function called strip_nulls and do string_replace.
function strip_nulls($unsafe_string) {
return str_replace("\0","",$unsafe_string);
}
--
Thomas Swan, tswan at idigx dot com
John Herren, john at d2interactive dot com