Sort php multidimensional array by sub-value [duplicate]

You can use the usort function.

function cmp($a, $b) {
        return $a["mid"] - $b["mid"];
}
usort($arr, "cmp");

See it

Leave a Comment