note 68442 deleted from function.empty by nlopess

From: Date: Thu, 27 Jul 2006 12:21:54 +0000
Subject: note 68442 deleted from function.empty by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-115259@lists.php.net to get a copy of this message
Note Submitter: stendall at gmail dot com ---- This function recursively cleans empty elements of an Array. It doesn't consideres numeric 0 and string '0' as empty values, but will clean al discarded values by trim(); function cleanEmptyArray($array){ $ret=array(); foreach($array as $i){ if(is_array($i)) array_push( &$ret,cleanEmptyArray($i)); else{ if(trim($i)!='') array_push(&$ret,trim($i)); } } return $ret; }

« previous php.notes (#115259) next »