Voting

: min(four, eight)?
(Example: nine)

The Note You're Voting On

xyz at record dot contact
2 years ago
If you want to reindex an array, say to add an ID to each item as a key, you can use the following:

$array = [['id' => 3, 'name' => 'bob'], ['id' => 4, 'name' => 'alice']];
array_reduce($array, fn($new_array, $item) => $new_array + [$item['id'] => $item], []);

Result:

[ 3 => ["id" => 3, "name" => "bob"], 4 => ['id' => 4, 'name' => 'alice'] ]

<< Back to user notes page

To Top