我有来自 postgres 数据库的数组,我想按如下数据定义的顺序进行排序:
$order = array(77082, 77083, 77084, 77085, 77086, 77087, 77088, 77089, 77090, 77091, 77092, 77093, 77094, 77095, 77096, 77097, 77098, 77099, 77100, 77101);
大批:
array(
array("id" => 77083, "title" => "Test"),
array("id" => 77081, "title" => "Test") ...
);
排列:
array(
array("id" => 77081, "title" => "Test"),
array("id" => 77083, "title" => "Test") ...
);
以某种方式按 $order 数组 ID 对数组进行排序。
下一个示例: $order = array(77082, 65666, 90555, 35000);
大批:
array(
array("id" => 35000, "title" => "Test3"),
array("id" => 65666, "title" => "Test1")
array("id" => 77082, "title" => "Test")
array("id" => 90555, "title" => "Test2")
);
排列:
array(
array("id" => 77082, "title" => "Test"),
array("id" => 65666, "title" => "Test1")
array("id" => 90555, "title" => "Test2")
array("id" => 35000, "title" => "Test3")
);