I got the code as follows bellow. I'm having some problems to get it to
work. Maybe some of you are able to help me a bit.
First of all I got an array (salespersons) containing names of dynamic array
names. For example it can contain Johan, Mark, Jenny, Bill etc.
By calling for the possision in
-Ursprungligt meddelande-
Från: Jonas Rosling [mailto:[EMAIL PROTECTED]
Skickat: den 23 maj 2006 10:06
Till: PHP List
Ämne: [PHP] Getting an advanced foreach to work
Should look like this:
foreach (${$salespersons[$count]} AS $key = $value) {
--
PHP General Mailing List (http
this shoul work:
while ($count count($salespersons)) {
foreach ($salespersons[$count] AS $key = $value) {
echo htmlentities($key).' - '.$value;
$count++;
}
}
On 5/23/06, Jonas Rosling [EMAIL PROTECTED] wrote:
I got the code as follows
Jonas Rosling wrote:
...
while ($count count($salespersons)) {
I see you have solved it - just one comment.
This particular line will get evaluated every time. If you have a large
number of elements in $salespersons, it will slow things down considerably.
From a performance point of
-Ursprungligt meddelande-
Från: Chris [mailto:[EMAIL PROTECTED]
Skickat: den 23 maj 2006 10:24
Till: Jonas Rosling
Kopia: PHP List
Ämne: Re: [PHP] Getting an advanced foreach to work
From a performance point of view you're much better off doing:
$sales_count = count($salespersons
Chris wrote:
Jonas Rosling wrote:
...
while ($count count($salespersons)) {
I see you have solved it - just one comment.
This particular line will get evaluated every time. If you have a large
number of elements in $salespersons, it will slow things down considerably.
Quick
6 matches
Mail list logo