Skip to content
Home » Using usort in php OOPS

Using usort in php OOPS

Create a static function for sort inside class:

private static function merchantSort($a,$b) {
       return …// the sort
}

Call the sort function using below code:
$array = $this->someThingThatReturnAnArray();
usort($array, array(‘ClassName’,’merchantSort’));
Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *

0 Shares
Tweet
Pin
Share
Share
Share