note 129005 added to function.array-unshift
| From: | eliasritter168667 at gmail dot com | Date: | Mon, 06 Nov 2023 20:52:46 +0000 |
| Subject: | note 129005 added to function.array-unshift | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220961@lists.php.net to get a copy of this message | ||
This function helps if you want to prepend a key and value pair to the beginning of an array:
function array_kunshift(array $array, string|int $key, mixed $value): array {
return array_merge([$key => $value], $array);
}
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 2a02:8071:50c1:47c0:4511:c44b:184d:ac19)
----
Manual Page -- https://php.net/manual/en/function.array-unshift.php
Edit -- https://main.php.net/note/edit/129005
Del: integrated -- https://main.php.net/note/delete/129005/integrated
Del: useless -- https://main.php.net/note/delete/129005/useless
Del: bad code -- https://main.php.net/note/delete/129005/bad+code
Del: spam -- https://main.php.net/note/delete/129005/spam
Del: non-english -- https://main.php.net/note/delete/129005/non-english
Del: in docs -- https://main.php.net/note/delete/129005/in+docs
Del: other reasons-- https://main.php.net/note/delete/129005
Reject -- https://main.php.net/note/reject/129005
Search -- https://main.php.net/manage/user-notes.php