You are here: How to iterate throut an array? « PHP Programming Language « IT news, forums, messages
How to iterate throut an array?

Posted by <talthen.z-serwera.o2 on 08/09/06 16:01

Hello,
I have an array like this:

Array
(
[0] => Array
(
[1] => Array
(
[ID] => 7A585DC0
[Co] => Array
(
[C] => nat
[b] => 7A585DC0
)

[T] => Array
(
[1] => Array
(
[ID] =>7A585DC0

I want to delete some items from it. I think I have to do it recursively,
but PHP says:
"Fatal error: Only variables can be passed by reference in c:\www\p.php on
line 51"

The function looks like this:

function Del(&$tresc)
{
if (is_array($tresc['T'])) Del($tresc['T']);
else if (!$tresc['T'])
{
for ($x=0;$x<count($tresc);$x++)
{
Del($tresc[$x]); //THIS IS LINE 51
}
}
else if (($tresc['Co']['C']=='hl') and
(!$tresc['Co']['n']))
array_splice($tresc,0,1);
}

How to iterate through all elements and delete some of them?

Regards,
Talthen

 

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

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