AddBrainHandler x-httpd-php5 .php
On Tue, Jun 23, 2009 at 4:25 PM, Robert Cummings wrote:
> Ashley Sheridan wrote:
>
>> On Tue, 2009-06-23 at 15:07 -0400, Eddie Drapkin wrote:
>>
>>> It's just foreach($foo as $key => &$item) { }
>>>
>>> You can't assign the key by reference >.>
>>>
>>> On Tue, Ju
It's just foreach($foo as $key => &$item) { }
You can't assign the key by reference >.>
On Tue, Jun 23, 2009 at 3:04 PM, Ashley
Sheridan wrote:
> On Tue, 2009-06-23 at 12:56 -0600, kirk.john...@zootweb.com wrote:
>> Andres Gonzalez wrote on 06/23/2009 12:26:38 PM:
>>
>> > I want to modify $resul
Ashley Sheridan wrote:
On Tue, 2009-06-23 at 15:07 -0400, Eddie Drapkin wrote:
It's just foreach($foo as $key => &$item) { }
You can't assign the key by reference >.>
On Tue, Jun 23, 2009 at 3:04 PM, Ashley
Sheridan wrote:
On Tue, 2009-06-23 at 12:56 -0600, kirk.john...@zootweb.com wrote:
An
On Tue, 2009-06-23 at 15:07 -0400, Eddie Drapkin wrote:
> It's just foreach($foo as $key => &$item) { }
>
> You can't assign the key by reference >.>
>
> On Tue, Jun 23, 2009 at 3:04 PM, Ashley
> Sheridan wrote:
> > On Tue, 2009-06-23 at 12:56 -0600, kirk.john...@zootweb.com wrote:
> >> Andres Go
Thanks guys--passing by reference solved my problem. I was not aware
that the foreach statement works on a copy. This was explained in the
online documentation. Duh!!
Thanks again,
-Andres
Ashley Sheridan wrote:
On Tue, 2009-06-23 at 12:56 -0600, kirk.john...@zootweb.com wrote:
Andres
}
}
Or something to that effect, I just wrote that freehand, but you should get
the idea.
http://daevid.com
> -Original Message-
> From: Andres Gonzalez [mailto:and...@packetstorm.com]
> Sent: Tuesday, June 23, 2009 11:45 AM
> Cc: php-general@lists.php.net
> Subject: R
On Tue, 2009-06-23 at 12:56 -0600, kirk.john...@zootweb.com wrote:
> Andres Gonzalez wrote on 06/23/2009 12:26:38 PM:
>
> > I want to modify $results within the foreach. In other words,
> > during a given pass of this iteration, I want to delete some
> > of the items based on particular condition
Andres Gonzalez wrote on 06/23/2009 12:26:38 PM:
> I want to modify $results within the foreach. In other words,
> during a given pass of this iteration, I want to delete some
> of the items based on particular conditions. Then on the next
> pass thru the foreach, I want $results to be the newer,
{
if ($item == 'foo') unset($results[$key]);
}
-Original Message-
From: Andres Gonzalez [mailto:and...@packetstorm.com]
Sent: Tuesday, June 23, 2009 11:27 AM
To: php-general@lists.php.net
Subject: [PHP] modifying within foreach
In the following example:
foreach ($results as $key =&
foreach ($results as $key => $item)
{
if ($item == 'foo') unset($results[$key]);
}
> -Original Message-
> From: Andres Gonzalez [mailto:and...@packetstorm.com]
> Sent: Tuesday, June 23, 2009 11:27 AM
> To: php-general@lists.php.net
> Subject: [P
In the following example:
foreach ($results as $key => $item) {
//bla bla bla -- unset some of the $items
}
I want to modify $results within the foreach. In other words,
during a given pass of this iteration, I want to delete some
of the items based on particular conditions. Then on the ne
11 matches
Mail list logo