私はこのようになりますPHPの配列があります。PHPソート2D配列
Array{
[0] {
'id' => '0',
'title' => 'foo',
'address' => '123 Somewhere',
}
[1] {
'id' => '1',
'title' => 'bar',
'address' => '123 Nowhere',
}
[2] {
'id' => '2',
'title' => 'barfoo',
'address' => '123 Elsewhere',
}
[3] {
'id' => '3',
'title' => 'foobar',
'address' => '123 Whereabouts',
}
}
をし、私はこのように見えるように、ネストされた配列で「タイトル」キーでそれをソートします:私は、ネストされたキーの「ID」を経由して各ネストされた配列を追跡していますので、
Array{
[1] {
'id' => '1',
'title' => 'bar',
'address' => '123 Nowhere',
}
[2] {
'id' => '2',
'title' => 'barfoo',
'address' => '123 Elsewhere',
}
[0] {
'id' => '0',
'title' => 'foo',
'address' => '123 Somewhere',
}
[3] {
'id' => '3',
'title' => 'foobar',
'address' => '123 Whereabouts',
}
}
最初のレベルのキー値は重要ではありません。
私はksort()を使っていますが、成功しません。
可能重複http://stackoverflow.com/questions/2699086/php-sort-:ここ は、プレPHP 5.3版です多次元アレイによる) –