PHP ve MySQL bir iç içe Dizisi çıkış / yapısı ile sorun yaşıyorsanız

0 Cevap php

Im Bu durumda, filmler ve showdates, bir düzgün, yapılandırılmış bir liste yapmaya çalışıyorum.

$shows = array(
    array(
        "Thursday" => array(
            "17:00",
            "19:00")),
    array(
        "Friday" => array(
            "16:30",
            "18:45"
            "20:10")),
    array(
        "Saturday" => array(
            "18:30",
            "21:00"))
);

The problem is that I cant seem to be able to print the things out in a reasonable way. The days are supposed to be dynamic, not hard corded as of this case.

for ($row = 0; $row < $shows.length(); $row++) //Haven't got a clue about the 'length()'
{
    print $shows[$row] . "<br>"; //Print the day.

    for (

   $col = 0; $col < $shows[$row].length(); $col++) //Loop through each day.
    {
        print (">" . $shows[$row][$col] . "<br>"); //Print each time of the day.
    }

}

And what im trying to do is to print out each day with the corresponding times. Should come out as something like this.

Thursday - 17:00
           19:00

Friday   - 16:30
           18:45
           20:10

0 Cevap