php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15828 Trim() leaving 1 begining/ending whitespace
Submitted: 2002-03-02 03:09 UTC Modified: 2002-03-02 13:31 UTC
From: shane dot hochstetler at attbi dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.1.1 OS: WindowsXP Pro
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
31 + 40 = ?
Subscribe to this entry?

 
 [2002-03-02 03:09 UTC] shane dot hochstetler at attbi dot com
This is using php4isapi.dll

$var = '   content   ';
trim($var);
echo "->".$var."<-";
echo "->$var<-";

Output:
 -> content <-
 -> content <-

leaves 1 whitespace at the beginning and at the end.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-02 05:27 UTC] sander@php.net
RTFM! trim() returns the trimmed string.
$foo = trim($foo) and not trim($foo)
 [2002-03-02 12:52 UTC] shane dot hcohstetler at attbi dot com
This is using php4isapi.dll

$var = '   content   ';
$var = trim($var);      // fixed TYPO..
echo "->".$var."<-";
echo "->$var<-";

Output:
 -> content <-
 -> content <-

leaves 1 whitespace at the beginning and at the end.


and I have RTFM!!!
 [2002-03-02 13:31 UTC] shane dot hochstetler at attbi dot com
Not sure what it was, but I restarted IIS 5.1 and now it works.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 20:01:29 2024 UTC