class GameDesc { var $Name = ""; var $Description = ""; var $File = ""; } $games = array(); $games[0] = new GameDesc(); $games[0]->Name = "Snake"; $games[0]->Description = "A game with a snake thingy you have to move around. Don't hit your tail!"; $games[0]->File = "Snake.zip"; $games[1] = new GameDesc(); $games[1]->Name = "RPG"; $games[1]->Description = "A demo RPG!"; $games[1]->File = "RPG.zip"; $games[2] = new GameDesc(); $games[2]->Name = "Shooter"; $games[2]->Description = "A game where you shoot people up and shit."; $games[2]->File = "Shooter.zip"; $doc = new DOMDocument(); $doc->formatOutput = true; $r = $doc->createElement("games"); $doc->appendChild($r); foreach ($games as $game) { $b = $doc->createElement("game"); $name = $doc->createElement("name"); $name->appendChild($doc->createTextNode($game->Name)); $b->appendChild($name); $name = $doc->createElement("description"); $name->appendChild($doc->createTextNode($game->Description)); $b->appendChild($name); $name = $doc->createElement("file"); $name->appendChild($doc->createTextNode($game->File)); $b->appendChild($name); $r->appendChild( $b ); } echo "