|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20283 Trim function doesn't work at all
Submitted: 2002-11-06 10:00 UTC Modified: 2002-11-07 05:35 UTC
From: glanzafilippi at molinette dot piemonte dot it Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.2.3 OS: Linux RedHat 7.3
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:
Solve the problem:
9 + 29 = ?
Subscribe to this entry?

 [2002-11-06 10:00 UTC] glanzafilippi at molinette dot piemonte dot it
My Os is Linux Red Hat 7.3. Web Server is Zeus 4.1r3.
I compiled php with fastcgi.

i tried in several way but i noticed that in every case trim function doesn't work at all.

This is a little piece of code:
// $user_data['unitHospital'] == "Osp. San Giovanni"
$fileNameCleaned = trim($user_data['unitHospital']);

Osp. San Giovanni

OR directly

$tmp = trim("dd ff  hhkkk");

dd ff  hhkkk

The same result with 'rtrim' -- 'ltrim' and with a direct specification of charlist.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-06 10:04 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Trim function will only trim 'space' characters, unless you specify a list of characters you want to trim via the 2nd, optional parameter.
 [2002-11-07 02:36 UTC] glanzafilippi at molinette dot piemonte dot it
Thanks for your answer, but my question remain. I know that trim function only 'trim' spaces, but in my case trim doesn't trim anything. No spaces and no other charlist. 

From the online manual:
>Without the second parameter, trim() will strip these >characters:  
>" " (ASCII 32 (0x20)), an ordinary space.

Probably i'm explaining the problem in a wrong way. Please tell me where i'm wrong.

 [2002-11-07 05:21 UTC] m dot ford at lmu dot ac dot uk
Well, as your example values do not include any spaces which could be trimmed, I don't see how you can say trim() is not working!


 [2002-11-07 05:35 UTC] glanzafilippi at molinette dot piemonte dot it
Sorry, and sorry again. 

A superficial reading of the manual let me "think" that trim function strip every spaces or every charlist from the start to the end of a string. 

Thanks a lot for your patience.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 00:01:30 2024 UTC