PHP.....Fundamental
sorting as array of associative array.....using the value of perticular key: In ascending order: usort( $inventory , function ( $item1 , $item2 ) { return $item1 [ 'price' ] <=> $item2 [ 'price' ]; }); In descending order usort( $inventory , function ( $item1 , $item2 ) { return $item2 [ 'price' ] <=> $item1 [ 'price' ]; }); Other solution : array_multisort(array_column( $inventory , 'price' ), SORT_DESC, $inventory ); If you want Case Insensitive Sort on strings, you can use SORT_NATURAL|SORT_FLAG_CASE array_multisort(array_column( $inventory , 'key_name' ), SORT_DESC, SORT_NATURAL|SORT_FLAG_CASE, $inventory ); count occurrences of values in an associative array in php $employees = array ( 1 => array ( 'name' => 'Jason Alipala' , 'employee_id' => 'G1001-05' , 'position' => 1 ), 2 => array ( ...