note 33646 deleted from function.trim by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 12:20:21 +0000 |
| Subject: | note 33646 deleted from function.trim by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189630@lists.php.net to get a copy of this message | ||
Note Submitter: rwelti at yahoo dot com
----
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