Toggle onclick between ascending en descending date using PHP
问题 I have got this problem. I am trying to make a function where I can sort results by dates in a table. So far I got this: function wedstrijdenClub (){ $laMatches = WaterpoloAPI::call("Matches", "getMatches", Array( "", "", isset($_GET["ClubId"]) ? $_GET["ClubId"] : "", "", "", )); $asc = $laMatches; $desc = $laMatches ; // Sort Matches ascending usort($desc, function($a, $b) { return stringToUnix($a->Date) - stringToUnix($b->Date); }); // Sort Matches descending usort($asc, function($a, $b) {