📜  laravel 按函数排序' - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:39.101000             🧑  作者: Mango

代码示例3
$go = $go->sort(function ($a, $b) use ($order) {
  $pos_a = array_search($a->colour, $order);
  $pos_b = array_search($b->colour, $order);
  return $pos_a - $pos_b;
});