note 33646 added to function.trim
| From: | rwelti at yahoo dot com | Date: | Wed, 02 Jul 2003 22:45:43 +0000 |
| Subject: | note 33646 added to function.trim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51386@lists.php.net to get a copy of this message | ||
Regarding the editor's note to rhelic above about how to trim all elements in an array:
I wanted a perl "chomp" of newlines for all elements in an array.
I tried array_filter for a long time, but rhelic's straightforward way is what worked.
// chomp newlines off all elements in stations array
$stations = array_filter($stations, 'trim'); // editor's way - nope
foreach ($stations as $key => $value) {
$stations[$key] = trim($value); } // works fine
using PHP 4.3.1 on Solaris
----
Manual Page -- http://www.php.net/manual/en/function.trim.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33646
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33646&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33646&report=yes