You are here: Re: PHP5, foreach and memory corruption « PHP Language « IT news, forums, messages
Re: PHP5, foreach and memory corruption

Posted by Colin McKinnon on 08/22/05 14:03

Anze wrote:

> Hi!
>
> I have just fixed my CMS so it works on PHP5 (it worked without problems
> on PHP4 but gave weird errors on PHP5).
<snip>
> This solved the problem:
>
> echo ("BEFORE: ".count($this->someLargeArrayWithObjects)); // outputs 11
> $keys=array_keys($this->someLargeArrayWithObjects);
> foreach ($keys as $key)
> {
> $value=&$this->someLargeArrayWithObjects[$key];
> $a=$value['object']->someFunction();
> };
> echo ("AFTER: ".count($this->someLargeArrayWithObjects)); // outputs 11
>

It doesn't really solve the problem but did you try:

foreach ($this->someLargeArrayWithObjects as $key=>$value)
{
$a=someLargeArrayWithObjects['key']['object']->someFunction();
}

C.

 

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

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