SHOW:
|
|
- or go back to the newest paste.
| 1 | - | // Let's order the tickets in ascending order by price |
| 1 | + | // Let's order the tickets in descending order by price |
| 2 | usort($tickets, function($p, $q) {
| |
| 3 | - | if ($p->price < $q->price) return -1; |
| 3 | + | if ($p->price < $q->price) return 1; |
| 4 | - | if ($p->price > $q->price) return 1; |
| 4 | + | if ($p->price > $q->price) return -1; |
| 5 | return 0; | |
| 6 | }); |