Chào mọi người.
Hôm qua mình có hỏi câu này [Sắp xếp trong php] nhưng vẫn chưa giải quyết được nên mạo muội hỏi mn tiếp.
Ví dụ mình có một class trong php như sau:
<?php class Example { public function getData(){ // code return $data; } public function sort(){ $data = $this->getData(); // code sort return $data; // da duoc sap xep } }
Vả đây là data mà function getData trả về
> Array
> (
> [0] => Array
> (
> 'id' => 13,
> 'nameStudent' => "Tran Van B",
> 'birthDate' => "1996-05-31",
> 'emailStudent' => "[email protected]",
> 'phoneNumber' => "123123123",
> 'pictureProfile' => "images1675493_google_chrome_logo_930x488.png",
> ),
> [1] => Array
> (
> 'id' => 16,
> 'nameStudent' => "Tran Van B",
> 'birthDate' => "1996-05-31",
> 'emailStudent' => "[email protected]",
> 'phoneNumber' => "1231234323123",
> 'pictureProfile' => "images1675493_google_chrome_logo_930x488.png",
> ),
> [2] => Array
> (
> 'id' => 16,
> 'nameStudent' => "Nguyen Van C",
> 'birthDate' => "1996-05-31",
> 'emailStudent' => "[email protected]",
> 'phoneNumber' => "1231234323123",
> 'pictureProfile' => "images1675493_google_chrome_logo_930x488.png",
> ),
> );
Thực sự mình vẫn chưa tìm thấy một giải pháp nào để sắp xếp được
- theo tên
- theo năm sinh
Của dữ liệu được getData trả về như kia. Mong m.n giúp đỡ