View Single Post
  #13  
Old 10-17-2009, 01:11 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Basically.

Instead of:
PHP Code:
array[0][0] = "bananna";
array[
0][1] = 1;
array[
1][0] = "orange";
array[
1][1] = 5
This:
PHP Code:
with( array[0] ) {
this.food "bananna";
this.price 1;
}
with( array[1] ) {
this.food "orange";
this.price 5;

See how this is much easier to udnerstand? Using multi-demension arrays can be such a pain in the butt sometimes. I would MUCH rather have arrays like my second example. But of course using a loop so I would not have to repeat these lines of code a million times.

I dont even know if you can use my first example and try and copy array[0] to newarray[0].. Possible? dunno. But you can see here I am looking at the array as the object. And giving info about it names rather then numbers in a multi demensional array.

Think of it as, when you hold something in your hand. That item has details about it.. Height, width, weight, color, smell... etc Would it make sence to say this items 0 value is 100 px.. its 1 value is 120px to explain to someone that its demensions are 100x120 ?
Reply With Quote