小编Nar*_*yas的帖子

PHP - 按数组键对数组进行排序

我在 PHP 中有这个数组:

在 PHP API 中,我有这个数组,想按 custom_price 排序,但不知道如何实现..

Array
(
    [0] => Array
        (
            [id] => 1204
            [custom_price] => 33.1500
        )


    [1] => Array
        (
            [id] => 1199
            [custom_price] => 16.83
        )

    [2] => Array
        (
            [id] => 1176
            [custom_price] => 16.83
        )

    [3] => Array
        (
            [id] => 1173
            [custom_price] => 11.73
        )

    [4] => Array
        (
            [id] => 1170
            [custom_price] => 22.5
        )
)
Run Code Online (Sandbox Code Playgroud)

我如何从 .. 高到低 & 从低到高 .. 按 custom_price 排序

php arrays sorting

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

arrays ×1

php ×1

sorting ×1