there has to be a better way of doing this
if (count($page) == 0) {
print_r($array["title"]);
}
if (count($page) == 1) {
print_r($array[$page[0]]["title"]);
}
if (count($page) == 2) {
print_r($array[$page[0]][$page[1]]["title"]);
}
if (count($page) == 3) {
print_r($array[$page[0]][$page[1]][$page[2]]["title"]);
}
if (count($page) == 4) {
print_r($array[$page[0]][$page[1]][$page[2]][$page[3]]["title"]);
}
if (count($page) == 5) {
print_r($array[$page[0]][$page[1]][$page[2]][$page[3]][$page[4]]["title"]);
}
if (count($page) == 6) {
print_r($array[$page[0]][$page[1]][$page[2]][$page[3]][$page[4]][$page[5]]["title"]);
}
how do I make a for loop that checks the length of one array an inputs the content of that array however many times as a reference for another array like the above if statement does but can go on forever in php
Aucun commentaire:
Enregistrer un commentaire