I\'m trying to get a simple sort function going using anonymous functions. One each for asc and desc sorting.
Is it possible to render the $sortBy vari
You can pass a variable in enclosing scope using the use keyword (Example #3 Closures and scoping):
$sortBy = 'some_key'; $sort['desc'] = function($x, $y) use ($sortBy) { // implementation };