XML文件内容:

<?xml version="1.0" encoding="utf-8"?>
<list>
	<match id="2650860" matchTime="2024-08-22 19:35" matchLeague="中协杯" matchRound="1/4决赛" hometeam="上海申花" guestteam="北京国安" matchHot="0" queryTime="2024-08-21 15:39:30"></match>
	<match id="2650861" matchTime="2024-08-22 19:35" matchLeague="中协杯" matchRound="1/4决赛" hometeam="上海海港" guestteam="天津津门虎" matchHot="0" queryTime="2024-08-21 15:39:41"></match>
	<match id="2653813" matchTime="2024-08-22 20:00" matchLeague="东盟锦标" matchRound="小组赛" hometeam="普萨马尼亚" guestteam="狮城水手" matchHot="0" queryTime="2024-08-21 15:40:04"></match>
	<match id="2652536" matchTime="2024-08-22 21:30" matchLeague="俄杯" matchRound="第2轮" hometeam="沃洛格达迪纳摩" guestteam="伊凡诺沃" matchHot="0" queryTime="2024-08-21 15:40:27"></match>
	<match id="2629853" matchTime="2024-08-23 22:00" matchLeague="阿联酋超" matchRound="第1轮" hometeam="奥鲁巴" guestteam="纳萨" matchHot="0" queryTime="2024-08-22 12:29:42"></match>
</list>
function sortByQuerytime($t1, $t2) {
	return strcmp($t1['@attributes']['matchTime'], $t2['@attributes']['matchTime']);
}

$xml = simplexml_load_file($xmlfile);
$match = $xml->children();
$xmljson = json_encode($match);
$xmlarray = json_decode($xmljson,true);//将json转换成数组
$matchs = $xmlarray['match'];
usort($matchs, 'sortByQuerytime');
//使用数组输出内容
for($i = 0, $i < count($matchs), $i++) {
......
}