multidimensional arrays

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
Todlerone
Forum Commoner
Posts: 96
Joined: Sun Oct 28, 2007 10:20 pm
Location: Hamilton, Ontario, Canada

multidimensional arrays

Post by Todlerone »

Hello everyone and again thank-you in advance for any replies. Can this happen in an array

Code: Select all

$standings[$x][0]=$standings[$x][0]+1;
That is, the contents of a cell be incremented and replaced or does one have create another level of the array.

Thanks :roll:
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: multidimensional arrays

Post by Christopher »

Yes, you can do that. To just increment you can also do:

Code: Select all

++$standings[$x][0];
// or
$standings[$x][0] += 1;
They all do the same thing.
(#10850)
Post Reply