Answer the question
In order to leave comments, you need to log in
Count() and sizeof() not working with multidimensional array?
array$data:
$data['films']
$data['films'][$i]['title']
$data['films'][$i]['cover']
$data['films'][$i]['actors']
$data['films'][$i]['genres']
$data['genres']
$data['genre']
$vars = $data['films'][$i];
$count = count($vars['genres']);
if ($count >0) {
for ($i = 0; $i < $count; $i++) {
echo '<a class="entry__tag" href="/'.$vars['genres'][$i]['url'].'">'.$vars['genres'][$i]['name'].'</a>, ';
}
}
Answer the question
In order to leave comments, you need to log in
Is it okay that you use the $i variable in the main loop and in the inner one?
They somehow overwrite each other, and at the output, FIG knows what is happening, most likely an eternal cycle.
foreach to help, both for the main loop and for the inner loop shown here.
Forget about for $i and that's it, an extra hassle.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question