PHP根据数组内某字段排序

$Data = [
['id' => 5, 'name' => '5555555555'],
['id' => 8, 'name' => '8888888888'],
['id' => 1, 'name' => '1111111111'],
];
$sort = array_column($Data, 'id');
array_multisort($sort, SORT_DESC, $Data);
print_r($Data);

返回结果:

Array
(
    [0] => Array
        (
            [id] => 8
            [name] => 8888888888
        )

    [1] => Array
        (
            [id] => 5
            [name] => 5555555555
        )

    [2] => Array
        (
            [id] => 1
            [name] => 1111111111
        )

)

ray ban 3025 silver timberland vibram shoes παπουτσια milagros harmont blaine andre johnson texans jersey andre johnson texans jersey andre johnson texans jersey polkupyörän rengas 26×1 95 roza kopalke tata scarpe houston texans andre johnson jersey texans andre johnson jersey bone lacoste xadrez Portugal staliniai elektroniniai laikrodžiai rockshox pike dj sale


发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

About Us

一米阳光是一个典故,云南丽江玉龙雪山终年云雾缭绕,只有每年秋分时节会有一米长的阳光照下来,传说被这一米阳光照到的人就能拥有美丽的爱情。意思就是让大家去把握现在可以得到的东西,追求一瞬间的真爱。

Featured Posts