note 86228 added to function.array-filter

From: Date: Wed, 08 Oct 2008 18:44:06 +0000
Subject: note 86228 added to function.array-filter
Groups: php.notes 
Request: Send a blank email to php-notes+get-145186@lists.php.net to get a copy of this message
Regarding comment about trimming empty strings, the code posted will get into an infinite loop if the array is reduced to zero elements. The following might be better: <?php function array_trim($array) { while (!empty($array) and strlen(reset($array)) === 0) { array_shift($array); } while (!empty($array) and strlen(end($array)) === 0) { array_pop($array); } return $array; } ?> ---- Server IP: 64.71.164.2 Probable Submitter: 69.228.143.185 ---- Manual Page -- http://www.php.net/manual/en/function.array-filter.php Edit -- https://master.php.net/note/edit/86228 Del: integrated -- https://master.php.net/note/delete/86228/integrated Del: useless -- https://master.php.net/note/delete/86228/useless Del: bad code -- https://master.php.net/note/delete/86228/bad+code Del: spam -- https://master.php.net/note/delete/86228/spam Del: non-english -- https://master.php.net/note/delete/86228/non-english Del: in docs -- https://master.php.net/note/delete/86228/in+docs Del: other reasons-- https://master.php.net/note/delete/86228 Reject -- https://master.php.net/note/reject/86228 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145186) next »