public function testIsort() { $list = ['b' => ['name' => 'b', 'value' => 2], 'a' => ['name' => 'a', 'value' => 1], 'c' => ['name' => 'c', 'value' => 3]]; $expected = ['a' => ['name' => 'a', 'value' => 1], 'b' => ['name' => 'b', 'value' => 2], 'c' => ['name' => 'c', 'value' => 3]]; $this->assertEquals($expected, Arrays::isort($list, 'name')); }
/** * Sort a list of arrays by the value of some index. This method is identical to * @{function:msort}, but operates on a list of arrays instead of a list of * objects. * * @param $list array List of arrays to sort by some index value. * @param $index string Index to access on each object; the return values * will be used to sort the list. * * @return array Arrays ordered by the index values. * @group util * * @deprecated */ function isort(array $list, $index) { return \Packaged\Helpers\Arrays::isort($list, $index); }