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.

0 Shares
Tweet
Pin
Share
Share
Share
%d bloggers like this: