PHP Array Fonksiyonu Çalışmıyor

0 Cevap php

Şu anda PHP diziler ile deney yaşıyorum ve ben bir takımın bilgiler ekrana gelecektir sahte bir ortam yarattı.

    $t1 = array (
            "basicInfo" => array (
                "The Sineps",
                "December 25, 2010",
                "lemonpole"
            ),
            "overallRecord" => array (0, 0, 0, 0),
            "overallSeasons" => array (
                1 => array (14, 0, 0),
                2 => array (9, 5, 2),
                3 => array (12, 4, 0),
                4 => array (3, 11, 2)
            ),
            "games" => array (
                "<img src=\"images/cs.gif\" alt=\"Counter-Strike\" />",
                "<img src=\"images/cs.gif\" alt=\"Counter-Strike\" />",
                "<img src=\"images/cs.gif\" alt=\"Counter-Strike\" />",
                "<img src=\"images/cs.gif\" alt=\"Counter-Strike\" />"
            ),
            "seasonHistory" => array (
                "Season I",
                "Season II",
                "Season III",
                "Season IV"
            ),
            "divisions" => array (
                "Open",
                "Main",
                "Main",
                "Invite"
            )
        );
// Displays the seasons the team has been in along
    // with the record of each season.
    function seasonHistory() {
        // Make array variable local-scope.
        global $t1;

        // Count the number of seasons.
        $numrows = count($t1["seasonHistory"]);

        // Loop through all the variables until
        // it reaches the last entry made and display
        // each item seperately.
        for($v = 0; $v <= $numrows; $v++) {
            // Echo each season.
            echo "<tr><td>{$t1["games"][$v]}</td>";
            echo "<td>{$t1["seasonHistory"][$v]}</td>";
            echo "<td>{$t1["divisions"][$v]}</td></tr>";
        }
    }

Ben birkaç olası sorunları test ettik ve onları daraltarak sonra ben bir sonuca aşağı gelmiş ve bu my function is not connecting to the array for some reason olduğunu. Ben küresel dizisi bu sorunu çözmek olur yapma düşündüm çünkü ben yapmak için başka ne bilmiyorum.

Ne işleri:

  1. I $t1["games"][0] sayfada bunu göstermek gerekiyor ve bana içerik verir yankı.

  2. Ben işlevi İÇ $t1["games"][0] yankı denenmiş ve sonra işlevini çağırma ve hiçbir şey göstermez.

0 Cevap