Man, that's a fun one to visualize. Yay for hypercubes. Out of curiosity, why do you need four dimensions?
sai4
ASKER
Thank you Zyloch very much.
Hi Attabui,
I'm a new teacher at a school, and yesterday they had the end of year "scheduling meeting." The meeting consists of trying to figure out when teachers can teach their classes. To solve the problem, one person went to the marker board and began making a table. To me that seems nuts so I wanted to try and solve the system using "solver from excel" or an algoithm like simulated simulated annealing, or a genetic algorithm. I'm interested in 4d arrays becasue what occurs on a period of a given day is constrained by subject, teacher and grade so I wanted to have an array like Period[Teacher][subject][day][grade]= "period number." Orignally I tried to download a trial copy of Matlab to do this but I wasn't able to so I figured if I'm going to use another language PHP would make it easy to post on the school intranet. Honestly it's been so long since I've done any of this stuff, so if you have any suggestions please let me know. After looking at this is seems a hash table would be better than an array.
$multi = array();
for ($i = 0; $i < 5; $i++) {
$multi[$i] = array();
for ($j = 0; $j < 5; $j++) {
$multi[$i][$j] = array();
for ($k = 0; $k < 5; $k++) {
$multi[$i][$j][$k] = array();
for ($l = 0; $l < 5; $l++) {
$multi[$i][$j][$k][$l] = $i.$j.$k.$l;
}
}
}
}
print_r($multi);