compu: foreach Problem

Beitrag lesen

<?php
require("xml.class.php");
$xml = new XmlWriter();

$array = array(
    array('monkey', 'banana', 'Jim'),
    array('hamster', 'apples', 'Kola'),
    array('turtle', 'beans', 'Berty'),
);

$xml->push('zoo');

foreach ($array as $animal) {
    $xml->push('animal', array('species' => $animal[0]));
    $xml->element('name', $animal[2]);
    $xml->element('food', $animal[1]);
    $xml->pop();
}

$xml->pop();
echo $xml->getXml();
?>

Das ist das Beispielscript. Und das funktioniert doch auch!!

Komisch.