On Mon, 12 Jul 2004 15:33:53 +1000, Justin French wrote: > 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]); > } > } > ?>
Sure, a one-liner: foreach ($in as $k => $v ) { if(empty($v)) unset($in[$k]); } ;). Really what do you need an internal function for something simple like that? thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php