今日よりも古いタスクを削除したいのですが、XML ファイルから要素を削除する方法がまだわかりません。
$xml_file = simplexml_load_file('file.xml');
foreach ($xml_file->task as $aTask) {
if ($aTask->date < $today) {
//$xml_file->removeChild($aTask); //doesnt work
}
}
以下は私のXMLファイルです。
<?xml version="1.0"?>
<calender>
<task><date>00/00/0000</date><title>My Birthday</title><description>Today is my birthday!</description></task><task><date>04/01/2013</date><title>ghh</title><description>jfhjhj</description></task><task><date>04/01/2013</date><title>egfwe</title><description>wefwef</description></task><task><date>04/01/2013</date><title>cvbhm</title><description>dhmdh</description></task><task><date>04/02/2013</date><title>gg</title><description>gg</description></task><task><date>04/02/2013</date><title>test</title><description>test</description></task><task><date>04/03/2013</date><title>ggg</title><description>ggg</description></task><task><date>04/03/2013</date><title>ssdv</title><description>ssdvs</description></task><task><date>04/03/2013</date><title>test</title><description>testtest</description></task><task><date>04/04/2013</date><title>tttt</title><description>ttttttttt</description></task><task><date>04/05/2013</date><title>qewerbqwer</title><description>bwerbwerbwebr</description></task><task><date>04/07/2013</date><title>fgj</title><description>fghj f</description></task><task><date>04/08/2013</date><title>test</title><description>swdefswde</description></task><task><date>04/09/2013</date><title>hj,h</title><description>hj,gh</description></task><task><date>04/16/2013</date><title>dfbd</title><description>dfbdfb</description></task><task><date>04/17/2013</date><title>dfb</title><description>dfb</description></task>
</calender>
誰かが私を助けてくれますか?