Mind Went To Hell...Array Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
partiallynothing
Forum Commoner
Posts: 61
Joined: Fri Nov 21, 2003 5:02 pm
Location: connecticut, usa

Mind Went To Hell...Array Question

Post by partiallynothing »

I don't know why I am having so much trouble...

I create an array, say

Code: Select all

<?php $this = array ('This' => 'This', 'That' => 'That') ?>
and then later I want to add to the array. Just doing

Code: Select all

<?php $this = array ('this2' => 'this2') ?>
erases the first array. How do you add to an array. Thanks!
jaxn
Forum Commoner
Posts: 55
Joined: Fri Jan 16, 2004 1:50 pm
Location: Nashville, TN

Re: Mind Went To Hell...Array Question

Post by jaxn »

Code: Select all

<?php $this['this2'] = 'this2'; ?>



Only use array() when you are first creating the array.

-Jackson
Post Reply