unset empty elements in an array

From: Date: Mon, 12 Jul 2004 05:33:53 +0000
Subject: unset empty elements in an array
Groups: php.general 
Request: Send a blank email to php-general+get-190219@lists.php.net to get a copy of this message
Hi, Looking for a one-liner to delete all empty elements in an array. I know I can do it with a foreach loop, but I'm hoping that I've missed an existing function in the manual which may already do this, or a simple one-liner to replace the foreach. <?php foreach($in as $k => $v) { if(empty($v)) { unset($in[$k]); } } ?> --- Justin French http://indent.com.au

« previous php.general (#190219) next »