note 36710 added to function.rtrim

From: Date: Mon, 20 Oct 2003 01:48:23 +0000
Subject: note 36710 added to function.rtrim
Groups: php.notes 
Request: Send a blank email to php-notes+get-58906@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.rtrim.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36710 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36710&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36710&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#58906) next »