はい、私は多くのテクニックを検索して試しましたが、何もうまくいかないようです。これが私の配列です:
Array
(
[0] => stdClass Object
(
[id] => 119
[name] => Business3
[start_date] => 1338789600
[end_date] => 1354604400
)
[1] => stdClass Object
(
[id] => 153
[name] => Business1
[start_date] => 1338962400
[end_date] => 1370498400
)
[2] => stdClass Object
(
[id] => 135
[name] => Business2
[start_date] => 1339653600
[end_date] => 1356937200
)
)
基本的にこれを名前キーで並べ替えたいのですが、Stackoverflowで試したすべての関数が機能していないようです。たとえば、エラーのない空白のページが表示されます。
私はこれを試しました:
function array_sort_by_column(&$arr, $col, $dir = SORT_ASC) {
$sort_col = array();
foreach ($arr as $key=> $row) {
$sort_col[$key] = $row[$col];
}
array_multisort($sort_col, $dir, $arr);
}
array_sort_by_column(json_decode(json_encode($businesses), true), 'name');
しかし、それはうまくいきませんでした。
何か案は?