note 69471 deleted from ref.array by nlopess

From: Date: Thu, 07 Sep 2006 11:02:44 +0000
Subject: note 69471 deleted from ref.array by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-116821@lists.php.net to get a copy of this message
Note Submitter: mail @ k n o t l o g dawt cawm ---- 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); } ?>

« previous php.notes (#116821) next »