note 36710 deleted from function.rtrim by betz
| From: | betz@php.net | Date: | Thu, 09 Feb 2006 16:40:46 +0000 |
| Subject: | note 36710 deleted from function.rtrim by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-103376@lists.php.net to get a copy of this message | ||
Note Submitter: me at prestonhunt dot com
----
You have to careful when specifying the second parameter (charlist) of rtrim. It appears that you
must use string interpolation (double quotes instead of single quotes) or it won't work like
you expect. For instance, if you wanted to strip spaces and tabs, this would not work:
rtrim("Ends in t ", ' \t') returns "Ends in" (apparently rtrim is
stripping spaces, slashes, and t's).
If you specify this instead (note use of double quotes on second parameter):
rtrim("Ends in t ", " \t") it returns the correct result ("Ends in
t")
Maybe this is obvious, but I thought I would share it since it was messing me up and took some time
to figure out.