|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-12-26 07:36 UTC] aitrus at tresgeek dot net
Description:
------------
When passed a string variable with a single space as its contents, trim() returns a variable with a single space as its contents.
Reproduce code:
---------------
$foo = " ";
$foo = trim( $foo );
echo "x{$foo}x";
--
output is: 'x x'
Expected result:
----------------
trim() should return a empty string (or false).
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 20 20:00:01 2025 UTC |
Works fine here: derick@kossu:~$ cat bug31301.php <?php $foo = " "; $foo = trim( $foo ); echo "x{$foo}x"; ?> derick@kossu:~$ php-4.3dev bug31301.php xxI apologize, my example was too simple and did not reproduce the problem: $foo = " "; $foo = html_entity_decode( $foo, ENT_QUOTES ); $foo = trim( $foo ); echo "x{$foo}x"; output is: 'x x'