note 26364 added to function.include

From: Date: Mon, 28 Oct 2002 16:28:47 +0000
Subject: note 26364 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-38649@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 -- http://www.php.net/manual/en/function.include.php http://master.php.net/manage/user-notes.php?action=edit+26364 http://master.php.net/manage/user-notes.php?action=delete+26364 http://master.php.net/manage/user-notes.php?action=reject+26364

« previous php.notes (#38649) next »