Getting an advanced foreach to work

From: Date: Tue, 23 May 2006 08:06:23 +0000
Subject: Getting an advanced foreach to work
Groups: php.general 
Request: Send a blank email to php-general+get-236695@lists.php.net to get a copy of this message
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 the array based on $count I'll get the name, and that's the name of another array. The problem is in the foreach with ( { } ). $count = 0; // Loopa så länge räknaren är mindre än storleken av arrayn $salespersons while ($count < count($salespersons)) { foreach (${$($salespersons[$count])} AS $key => $value) { echo htmlentities($key).' - '.$value; $count++; } } Anyone? Thaks // Jonas

« previous php.general (#236695) next »