0

私はxmlドキュメントから連想配列を持っています...私は自分のニーズに必要な構造で必要なデータを出力しています..

問題: テスト中に文字がエコー/出力されますが、その理由と原因が本当にわかりません..

Array
(
[AR] => Array
    (
        [Pt Lincoln] => Array
            (
                [Track Desc] => Good
                [Mtg Id] => 675546624
                [Track Rating] => 2
                [Weather] => Fine
                [Abandoned] => N
                [1] => Array
                    (
                        [Race Name] => 3YO 0 - 64 HANDICAP
                        [Distance] => 1000
                        [1] => Array
                            (
                                [Number] => 1
                                [Runner Name] => HEAVENS SHOUT
                                [Barrier] => 5
                            )
...

phpコード:

foreach($data_array as $id => $mtgid)
{
foreach($mtgid as $vname2 => $meet)
{
    echo $mtgid[$vname2]['Track Desc'];
    echo $mtgid[$vname2]['Mtg Id'];
    echo $mtgid[$vname2]['Track Rating'];
    echo $mtgid[$vname2]['Weather'];
    echo $mtgid[$vname2]['Abandoned'];


    foreach($meet as $race => $detail)
    {
        echo $meet[$race]['Race Name'];
        echo $meet[$race]['Distance'];

        foreach($detail as $horse => $selection)
        {
            echo $detail[$horse]['Number'];
            echo $detail[$horse]['Runner Name'];
            echo $detail[$horse]['Barrier'];
            echo "<br/>";

        }
        echo "<br/>";
    }   
}
}

?>

出力:

Good6755466242FineNGG
66
22
FF
NN
3YO 0 - 64 HANDICAP1000333
111
1HEAVENS SHOUT5
2HANK'S NEPHEW2
3RIFF RAFF1
4TIGARA'S GEM4
5THE HEADLINER8
6WHERE HEARTS LIE7
7SHEZA STAR3
8REDLEAF ROSE6

ランダムな文字は GG6622FFNN です

ガイダンスをいただければ幸いです。

4

1 に答える 1

0
foreach($data_array as $id => $mtgid)
{
foreach($mtgid as $vname2 => $meet)
{

    echo $mtgid[$vname2]['Track Desc'];
    echo $mtgid[$vname2]['Track Rating'];
    echo $mtgid[$vname2]['Weather'];
    echo $mtgid[$vname2]['Abandoned'];


    for($i=0; $i<count($meet); $i++)
    {
        echo $meet[$i]['Race Name'];
        echo $meet[$i]['Distance'];

        for($j=0; $j<count($meet[$i]); $j++)
        {
            echo $meet[$i][$j]['Number'];
            echo $meet[$i][$j]['Runner Name'];
            echo $meet[$i][$j]['Barrier'];
            echo "<br/>";

        }
        echo "<br/>";
    }   
}
}
于 2012-10-28T09:33:47.113 に答える