> 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 ),
> "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.

If you want to change the 'Cat01' key so it will be called, say, 'newname':

$cats['newname'] = $cats['Cat01'];
unset($cats['Cat01']);

If you just want to change a 1 to 0:

$cats['Cat01']['lv1'] = 0;

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to