note 62040 added to function.rtrim

From: Date: Fri, 17 Feb 2006 22:31:57 +0000
Subject: note 62040 added to function.rtrim
Groups: php.notes 
Request: Send a blank email to php-notes+get-103947@lists.php.net to get a copy of this message
True, the Perl chomp() will only trim newline characters. There is, however, the Perl chop() function which is pretty much identical to the PHP rtrim() --- Here's a quick way to recursively trim every element of an array, useful after the file() function : # Reads /etc/passwd file an trims newlines on each entry $aFileContent = file("/etc/passwd"); foreach ($aFileContent as $sKey => $sValue) { $aFileContent[$sKey] = rtrim($sValue); } print_r($aFileContent); ---- Server IP: 216.235.15.211 Probable Submitter: 70.80.26.243 ---- Manual Page -- http://www.php.net/manual/en/function.rtrim.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62040 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62040&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62040&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62040&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62040&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62040&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62040&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62040&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62040&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103947) next »