|
-
Aug 1st, 2002, 02:39 PM
#1
Thread Starter
Stuck in the 80s
Appending an Array
I have an array setup like this:
PHP Code:
$CONFIG = Array(
thing => "thing",
thing2 => "thing2",
thing3 => "thing3");
How can I add another item to this array later?
Something like:
PHP Code:
$CONFIG[] = thing4 => "thing4";
or something?
-
Aug 1st, 2002, 03:02 PM
#2
PowerPoster
Try
PHP Code:
array_push($CONFIG, "thing4");
-
Aug 1st, 2002, 03:05 PM
#3
Fanatic Member
Both will work if you change array_push($CONFIG, "thing4"); to
PHP Code:
array_push($CONFIG, thing4 => "thing4");
-
Aug 1st, 2002, 03:17 PM
#4
Thread Starter
Stuck in the 80s
cool, thanks
-
Aug 1st, 2002, 03:40 PM
#5
Frenzied Member
why not
$CONFIG[thing4] = "thing4";
unless the thing is dynamic then it would be
$CONFIG['$thing'] = "thing4";
-
Aug 1st, 2002, 07:48 PM
#6
Thread Starter
Stuck in the 80s
Originally posted by phpman
$CONFIG['$thing'] = "thing4";
Didn't know it would work that way. Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|