Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
/*Привет подскажите пожалуйста.
У меня есть массив*/
$arr = [
["id" => 1, "parent_id" => "", "name" => "a"],
["id" => 2, "parent_id" => "3", "name" => "b"],
["id" => 3, "parent_id" => "5", "name" => "c"],
];
//как мне отсортировать массив чтобы получилось так:
usort($arr, function ($a, $b) {
return $a["name"] <=> $b["name"];
});
print_r ($arr);