Edit report at http://bugs.php.net/bug.php?id=54697&edit=1

 ID:                 54697
 Updated by:         ras...@php.net
 Reported by:        narjsifatima at yahoo dot com
 Summary:            trim function not giving right results
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Strings related
 Operating System:   WindowsXP
 PHP Version:        5.3SVN-2011-05-09 (snap)
 Block user comment: N
 Private report:     N

 New Comment:

trim, as per the documentation, trims a string "from the beginning and
end of a 

string" it doesn't replace characters in the middle of it. You probably
want a 

str_replace here.



str_replace(array('H','d','W','r'),'',$hello);


Previous Comments:
------------------------------------------------------------------------
[2011-05-09 18:37:48] narjsifatima at yahoo dot com

Description:
------------
I am writing a simple function which is not giving the correct result.



Please somebody check it.

Test script:
---------------
Here is the code.



$hello  = "Hello World";

$trimmed = trim($hello, "HdWr");

echo($trimmed);

Expected result:
----------------
ello ol

Actual result:
--------------
ello Worl


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54697&edit=1

Reply via email to