why not just do this?

$this->m_menu[$index] = array("title"=>$title, "content"=>"",
"color"=>$color);


-----Original Message-----
From: Joe Pemberton [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 2:23 PM
To: php list
Subject: [PHP] dynamic indexes in arrays


I have a member variable of a class that I am designing called $m_menu.  I
am trying to add items to it using the contents of $index as the index for
the 'slot' in the array, but I get a parse error when I do so.
 
array_push($this->m_menu, $index =>array("title"=>$title, "content"=>"",
"color"=>$color));

Is there any way to create indexes in arrays from variables?
- - Joe

[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to