note 69471 added to ref.array

From: Date: Thu, 07 Sep 2006 02:20:49 +0000
Subject: note 69471 added to ref.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-116796@lists.php.net to get a copy of this message
I searched for something like this in the function list to no avail. Maybe I missed it. I'd like to see some form of this simple, yet useful, function added to the built in functions of PHP. This strips empty values from arrays, but preserves their keys, rather than reassigning them from 0. <?php function array_pare($array) { if (is_array($array)) { foreach($array as $key => $value) { if($value == "") { unset($array[$key]); } } } return($array); } ?> ---- Server IP: 64.71.164.2 Probable Submitter: 24.218.49.98 ---- Manual Page -- http://www.php.net/manual/en/ref.array.php Edit -- https://master.php.net/note/edit/69471 Del: integrated -- https://master.php.net/note/delete/69471/integrated Del: useless -- https://master.php.net/note/delete/69471/useless Del: bad code -- https://master.php.net/note/delete/69471/bad+code Del: spam -- https://master.php.net/note/delete/69471/spam Del: non-english -- https://master.php.net/note/delete/69471/non-english Del: in docs -- https://master.php.net/note/delete/69471/in+docs Del: other reasons-- https://master.php.net/note/delete/69471 Reject -- https://master.php.net/note/reject/69471 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116796) next »