A
Al Cholic
Hello,
I have an array that has elements that are arrays.
It looks like this(I'll call it array), it has:
[
[POS1, POS2a\, POS2b, POS3, POS4], # this array is in position
array[0]
[POS2c\, POS2d\, POS2e], # this array is in position
array[1]
[POS2f\, POS2g\, POS2h], # this array is in position
array[2]
[POS1, POS2a\, POS2b, POS3, POS4] # this array is in position
array[3]
]
Notice that Im trying to escape the commas with the backslash in the
array. Is this the proper ways to escape commas in arrays? The POS2's
are separated with commas(not to confuse them with the commas that
separate the array elements).
So, what Im trying to do is have arrays array[1] and array[2] added to
position array[0][1] and then have array[1] and array [2] deleted and
the have the next element from array moved downward in into the position
where array[1] and array[2] use to be.
So the final array should look like this:
[
[POS1, POS2a\, POS2b\, POS2c\, POS2d\, POS2f\, POS2g\, POS2h\, POS2e,
POS3, POS4],
[POS1, POS2a\, POS2b, POS3, POS4]
]
Does it make sense to store all of this information inside arrays or
would hashes be better? Im shuffling this data around to have ir ready
to be placed inside of a database. Is this the best setup for that?
This is the first time I've had to move arrays around like this and it
got me really confused. Also, should I split the POS2a\, POS2b\, POS2c\
up into another array and have a three leveled array?
Could someone please write a preliminary loop for this type of operation
to get me on the right track or give advice on what I should be doing.
Thanks in advance.
I have an array that has elements that are arrays.
It looks like this(I'll call it array), it has:
[
[POS1, POS2a\, POS2b, POS3, POS4], # this array is in position
array[0]
[POS2c\, POS2d\, POS2e], # this array is in position
array[1]
[POS2f\, POS2g\, POS2h], # this array is in position
array[2]
[POS1, POS2a\, POS2b, POS3, POS4] # this array is in position
array[3]
]
Notice that Im trying to escape the commas with the backslash in the
array. Is this the proper ways to escape commas in arrays? The POS2's
are separated with commas(not to confuse them with the commas that
separate the array elements).
So, what Im trying to do is have arrays array[1] and array[2] added to
position array[0][1] and then have array[1] and array [2] deleted and
the have the next element from array moved downward in into the position
where array[1] and array[2] use to be.
So the final array should look like this:
[
[POS1, POS2a\, POS2b\, POS2c\, POS2d\, POS2f\, POS2g\, POS2h\, POS2e,
POS3, POS4],
[POS1, POS2a\, POS2b, POS3, POS4]
]
Does it make sense to store all of this information inside arrays or
would hashes be better? Im shuffling this data around to have ir ready
to be placed inside of a database. Is this the best setup for that?
This is the first time I've had to move arrays around like this and it
got me really confused. Also, should I split the POS2a\, POS2b\, POS2c\
up into another array and have a three leveled array?
Could someone please write a preliminary loop for this type of operation
to get me on the right track or give advice on what I should be doing.
Thanks in advance.