$data) { // Reverse the array $data['revisions'] = array_reverse($data['revisions'], true); foreach($data['revisions'] as $rev) { $changelog[$rev]['name'] = $name; $changelog[$rev]['colour'] = $data['colour']; $changelog[$rev]['changes'] = array(); } } // Sort changes properly foreach($changelogFile['changelog'] as $ver => $data) { // Reverse the array $data = array_reverse($data, true); // Add the log to the array foreach($data as $id => $change) $changelog[$ver]['changes'][$id] = $change; } // Add a thing to only get the json if(isset($_REQUEST['getjson'])) { // Print encoded json and exit print json_encode($changelog); exit; } // Create variable to store HTML in $changelogHTML = null; // Format HTML foreach($changelog as $revisionId => $revisionData) { $changelogHTML .= '