I have array like below
Array
(
    [0] => Array
        (
            [0] => 1280
            [id] => 1280
        )
    [1] => Array
        (
            [0] => 2261
            [id] => 2261
        )
    [2] => Array
        (
            [0] => 1280
            [id] => 1280
        )
)
In php, How do I sort from low to high based on the value of "id" ?
use usort(), like:
function sortById($x, $y) {
    return $x['id'] - $y['id'];
}
usort($array, 'sortById');
echo "<pre>"; print_r($array);
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With