<?php
$log=@file('chat.log');
if(!is_array($log)){$log=array();}
if(isset($_POST['monolog'])){
array_unshift($log, $_POST['monolog']."\n");
$log=array_slice($log, 0, 10) ;
file_put_contents('chat.log', $log) ;
header('location: 10line_chat.php') ;
exit;
}
?>
<html><hrad></head><body><p>10行チャット<br>
<form method="post" action="10line_chat.php">
<input type="submit" value="送信"><input type="text" name="monolog"></form></p>
<?php
foreach($log as $idx=>$value){
echo '<hr>'.$value ;
}
?>
<hr></body></html>

【問題】xmlを再帰的に配列に変換する関数を定義せよ