note 77573 added to function.array-filter

From: Date: Tue, 04 Sep 2007 17:56:47 +0000
Subject: note 77573 added to function.array-filter
Groups: php.notes 
Request: Send a blank email to php-notes+get-130173@lists.php.net to get a copy of this message
This function trims empty strings from the beginning and end of an array. It's useful when outputing plaintext files on a page and you want to skip empty lines at the beginning and end, but not within the text. function array_trim($array) { while (strlen(reset($array)) === 0) { array_shift($array); } while (strlen(end($array)) === 0) { array_pop($array); } return $array; } You might want to trim each element too. ---- Server IP: 62.73.196.231 Probable Submitter: 194.19.108.15 ---- Manual Page -- http://www.php.net/manual/en/function.array-filter.php Edit -- https://master.php.net/note/edit/77573 Del: integrated -- https://master.php.net/note/delete/77573/integrated Del: useless -- https://master.php.net/note/delete/77573/useless Del: bad code -- https://master.php.net/note/delete/77573/bad+code Del: spam -- https://master.php.net/note/delete/77573/spam Del: non-english -- https://master.php.net/note/delete/77573/non-english Del: in docs -- https://master.php.net/note/delete/77573/in+docs Del: other reasons-- https://master.php.net/note/delete/77573 Reject -- https://master.php.net/note/reject/77573 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130173) next »