我有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")
);