Automattic\WooCommerce\Admin\API\Reports
DataStore::sort_array()
Sorts array of arrays based on subarray key $sort_by.
Method of the class: DataStore{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->sort_array( $arr, $sort_by, $direction );
- $arr(array) (required) (passed by reference — &)
- Array to sort.
- $sort_by(string) (required)
- Ordering property.
- $direction(string) (required)
- DESC/ASC.
DataStore::sort_array() DataStore::sort array code WC 8.7.0
protected function sort_array( &$arr, $sort_by, $direction ) { $this->order_by = $this->normalize_order_by( $sort_by ); $this->order = $direction; usort( $arr, array( $this, 'interval_cmp' ) ); }