I have two arrays like given below
<?php
$series = array
(
0 => "Series A",
1 => "Series B",
2 => "Series C",
3 => "Series D",
4 => "Series E",
5 => "Series F"
);
$episodes = array
(
0 => array ( 0 => "a0" ),
1 => array ( 0 => "b0", 1 => "b1" ),
2 => array ( 0 => "c0", 1 => "c1" ),
3 => array ( 0 => "d0" ),
4 => array ( 0 => "e0" ),
5 => array ( 0 => "f0" )
);
?>
What I'm trying to do is to link these two arrays so the output will look like this
Desired Output
Series A- a0
Series B- b0, b1
Series C- c0, c1
Series D- d0
Series E- e0
Series F- f0
To achieve this, I iterated the arrays like this but I'm not getting the desired output.
<ul>
<?php
for($i=0; $i<sizeof($series); $i++)
{
foreach($episodes as $row => $innerArray){
foreach($innerArray as $innerRow => $value){
$value = $value.', ';
}
echo "<li>".$series[$i]."- ".$value."</li>";
}
}
?>
</ul>