common/utilities/DataUtil.php
public static function sortObjectArrayByNumber( $array, $attribute, $asc = true ) {

		uasort( $array, function( $item1, $item2 ) use ( $attribute, $asc ) {

			if( $asc ) {

				return $item1->$attribute > $item2->$attribute;
			}
			else {

				return $item1->$attribute < $item2->$attribute;
			}
		});

		return $array;
	}
public static function sortObjectArrayByNumber( $array, $attribute, $asc = true ) {

		uasort( $array, function( $item1, $item2 ) use ( $attribute, $asc ) {

			if( $asc ) {

				return $item1->$attribute > $item2->$attribute;
			}
			else {

				return $item1->$attribute < $item2->$attribute;
			}
		});

		return $array;
	}
public static function sortObjectArrayByNumber ( $ array , $ attribute , $ asc = true ) { uasort ( $ array , function ( $ item1 , $ item2 ) use ( $ attribute , $ asc ) { if ( $ asc ) { return $ item1 -> $ attribute > $ item2 -> $ attribute ; } else { return $ item1 -> $ attribute < $ item2 -> $ attribute ; } } ) ; return $ array ; }
The method sort give object array using the attribute having number value. The array objects will be sorted in ascending order by default.
It expects that all the array elements must have the given attribute.
The method sort give object array using the attribute having number value . The array objects will be sorted in ascending order by default . It expects that all the array elements must have the given attribute .