return function ( $a, $b ) use ( $key, $sub ) {
if ( isset( $a[$key] ) && isset( $b[$key] ) ) {
// Descending sort: larger values will be first in result.
return function ( $a, $b ) use ( $key, $sub ) {
if ( isset( $a[$key] ) && isset( $b[$key] ) ) {
// Descending sort: larger values will be first in result.