Re: Re: unset empty elements in an array

From: Date: Mon, 12 Jul 2004 18:23:14 +0000
Subject: Re: Re: unset empty elements in an array
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-190269@lists.php.net to get a copy of this message
"Curt Zirzow" <php-general@zirzow.dyndns.org> wrote in message news:20040712181820.GC45209@bagend.shire... > * Thus wrote Justin French: > > On 12/07/2004, at 6:38 PM, Thomas Seifert wrote: > > > > My view of internal functions is that they solve common, repetitive > > problems. Sure, some of those problems are quite complex, but others > > are not. A perfect example would be array_walk() -- it can be solved > > in a "one liner" too: > > > > foreach ($in as $k => $v ) { $in[$k] = myFunction($v); } > > > > ... but someone decided it was useful as an internal function. My hope > > was that there was such a function to delete empty array elements > > already defined in PHP, but since it appears there isn't, I'll just > > keep including my own from a library file. > > The problem with your function you want is that it is very > specific, the name would have to be something like: > > unset_array_items_only_if_val_is_empty($array); What about: array_unset_empty_values() or array_remove_empty_values() :-) Torsten

« previous php.general (#190269) next »