You are here: Re: filtering key-value pairs in a multidimensional array « PHP Programming Language « IT news, forums, messages
Re: filtering key-value pairs in a multidimensional array

Posted by Erwin Moller on 10/01/07 13:08

Snaggy wrote:
> I have a multidimensional array with a few entries I need to delete.
> Key and values are not unique in different sub arrays.
>
> As far as I know the filter function is not recursive and only deletes
> values, not keys.
>
> How can I do that?
>
> thanks
> Luca
>

Hi,

Then don't use filter, but use unset() on the elements you want to delete.

$arr = array(
"one" => array(1,"yes","no"),
"two" => 23,
"something" => array(array(1,2,3),55)
);

if you want to delete the 55:
unset ($arr["something"][1]);

if you want to delete the whole "something":
unset ($arr["something"]);

etc.

But without more information, this might be irrelevant. ;-)
Regards,
Erwin Moller

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация