Artificial Sorting and Closures in PHP