Associated arrays

From: Date: Tue, 26 Jun 2001 14:10:55 +0000
Subject: Associated arrays
Groups: php.general 
Request: Send a blank email to php-general+get-55244@lists.php.net to get a copy of this message
Hi Can someone help me out by explaining how I can programatically rename the key of an associated array? EG Cat01,Cat02 in the example below. $cats = array( "Cat01" => array("lv1" => 1, "lv2" => 1, "lv3" => 1, "lv4" => 1, "lv5" => 1 ), "Cat02" => array("lv1" => 1, "lv2" => 1, "lv3" => 1, "lv4" => 1, "lv5" => 1 ), "Cat03" => array("lv1" => 1, "lv2" => 1, "lv3" => 1, "lv4" => 1, "lv5" => 1 ), "Cat04" => array("lv1" => 1, "lv2" => 1, "lv3" => 1, "lv4" => 1, "lv5" => 1 ), "Cat05" => array("lv1" => 1, "lv2" => 1, "lv3" => 1, "lv4" => 1, "lv5" => 1 ), "Cat06" => array("lv1" => 1, "lv2" => 1, "lv3" => 1, "lv4" => 1, "lv5" => 1 ), "Cat07" => array("lv1" => 1, "lv2" => 1, "lv3" => 1, "lv4" => 1, "lv5" => 1 ), "Cat08" => array("lv1" => 1, "lv2" => 1, "lv3" => 1, "lv4" => 1, "lv5" => 1 ), "Cat09" => array("lv1" => 1, "lv2" => 1, "lv3" => 1, "lv4" => 1, "lv5" => 1 ), "Cat10" => array("lv1" => 1, "lv2" => 1, "lv3" => 1, "lv4" => 1, "lv5" => 1 )); How do I reference the name of each category i.e Cat01, Cat02 so that I can programatically change the name (I need them to be user defineable). This is part of a security level options setup screen by the way, that is the lv1-5 are user levels - boolean so that we can allow disallow access to approriate option/categories. I enclose the script I am trying to build if you have time to check it out. Thanks in advance Regards Tony Ayling Harmony so

« previous php.general (#55244) next »