问题:
最好的 PHP 7 + 方法是根据array
的数组实例(string
)值对以下array->status
进行排序的。
目标:
根据array
值对status
重新排序。如果值为“ StatusAvailable
”,我想将array
实例移到array
的顶部。由于array
可能包含定义状态为“ StatusAvailable
”的多个实例,因此下一个排序条件回退将是date
值。
Array
(
[0] => stdClass Object
(
[date] => 1432875600000
[value1] => TEXT
[value2] => TEXT
[value3] => TEXT
[value4] => TEXT
[value5] => TEXT
[status] =>
[value6] => TEXT
[value7] =>
)
[1] => stdClass Object
(
[date] => 1432875600000
[value1] => TEXT
[value2] => TEXT
[value3] => TEXT
[value4] => TEXT
[value5] => TEXT
[status] => StatusAvailable
[value6] => TEXT
[value7] =>
)
[2] => stdClass Object
(
[date] => 14472543800000
[value1] => TEXT
[value2] => TEXT
[value3] => TEXT
[value4] => TEXT
[value5] => TEXT
[status] => SomeOtherStatus
[value6] => TEXT
[value7] =>
)
[3] => stdClass Object
(
[date] => 1467349200000
[value1] => TEXT
[value2] => TEXT
[value3] => TEXT
[value4] => TEXT
[value5] => TEXT
[status] => StatusAvailable
[value6] => NO
[value7] =>
)
# the array list can/will continue at random length
)