diff options
author | cflip <36554078+cflip@users.noreply.github.com> | 2021-04-17 17:36:18 -0600 |
---|---|---|
committer | cflip <36554078+cflip@users.noreply.github.com> | 2021-04-17 17:36:18 -0600 |
commit | faae3f3906575b9c72d628a5e48d03f943c794fc (patch) | |
tree | ae3290ba4a1377f95f5c2081ffebe7124958872c /viewcategory.php | |
parent | 0b045d57b2164b5ce003955d79627ae506a153eb (diff) |
Automatically sort threads without PHP comparisons
Diffstat (limited to 'viewcategory.php')
-rw-r--r-- | viewcategory.php | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/viewcategory.php b/viewcategory.php index a10afce..e10797a 100644 --- a/viewcategory.php +++ b/viewcategory.php @@ -39,17 +39,7 @@ if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) { <th>Latest Post</th> </tr> <?php - function cmp($a, $b) { - $da = strtotime($a->date_lastpost); - $db = strtotime($b->date_lastpost); - - if ($da == $db) return 0; - - return ($da > $db) ? -1 : 1; - } - $threads = $current->get_threads($dbc); - usort($threads, "cmp"); foreach ($threads as $thread) { $latest_post = $thread->get_latest_post($dbc); |