change sortArray to support PHP 5.2

Add a workaround for not using anonymous functions.