我已经与PHP手册的例子麻烦,所以我想在这里问这个?
我有对象的数组..有没有一种方法基于对象的内容进行排序呢?
例如,我的数组是:
Array
(
[0] => stdClass Object
(
[id] => 123
[alias] => mike
)
[1] => stdClass Object
(
[id] => 456
[alias] => alice
)
[2] => stdClass Object
(
[id] => 789
[alias] => zeke
)
[3] => stdClass Object
(
[id] => 987
[alias] => dave
)
)
如何通过【别名】对象的数组排序?
在该示例中,输出应该是:
Array
(
[0] => stdClass Object
(
[id] => 456
[alias] => alice
)
[1] => stdClass Object
(
[id] => 987
[alias] => dave
)
[2] => stdClass Object
(
[id] => 123
[alias] => mike
)
[3] => stdClass Object
(
[id] => 789
[alias] => zeke
)
)
提前致谢!