芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/vendor/azjezz/psl/src/Psl/Dict/reindex.php
42, 'name' => 'foo'], * ['id' => 24, 'name' => 'bar'] * ]; * * Dict\reindex($users, fn($user) => $user['id']) * => Dict( * 42 => ['id' => 42, 'name' => 'foo'], * 24 => ['id' => 24, 'name' => 'bar'] * ) * * @template Tk1 * @template Tk2 of array-key * @template Tv * * @param iterable
$iterable Iterable to reindex * @param (Closure(Tv): Tk2) $function * * @return array
*/ function reindex(iterable $iterable, Closure $function): array { $result = []; foreach ($iterable as $value) { $result[$function($value)] = $value; } return $result; }