Re: cvs: pearweb /public_html/bugs/include functions.inc

From: Date: Mon, 07 Jun 2004 21:25:47 +0000
Subject: Re: cvs: pearweb /public_html/bugs/include functions.inc
References: 1  Groups: php.pear.cvs php.pear.webmaster 
Request: Send a blank email to pear-webmaster+get-2497@lists.php.net to get a copy of this message
On 7 Jun 2004 at 16:56, Daniel Convissor wrote: > On Mon, Jun 07, 2004 at 08:29:18PM -0000, Helgi Þormar Þorbjörnsson wrote: > > ampersand on line 628 broke the file :) > ... snip ... > > - foreach ($pkgname as $key => &$value) { > > + foreach ($pkgname as $key => $value) { > > Thanks. I was testing it on PHP 5 and it worked fine. Switching to PHP 4 > and, well, barf. > > I did that because I was misremembering about the ability to modify values > of an array while working in foreach. There is something along these > lines in which references are needed. Now, what WAS I remembering? :) It could be that you wanted to be able to modify $value directly in the foreach-loop? I once was told this should be possible in php5 :-) But using php4 you still have to use array and key to assign a new value to the correct element: $pkgname[$key] = $newvalue; I agree doing it the php5-way looks cleaner. However, for the moment imho we can pretty well live with the portable way. Stefan

« previous php.pear.webmaster (#2497) next »