note 126019 added to function.array-splice
| From: | Anonymous at main dot php dot net | Date: | Sat, 17 Apr 2021 10:02:21 +0000 |
| Subject: | note 126019 added to function.array-splice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216293@lists.php.net to get a copy of this message | ||
the following:
$input = [5=>"richard=red", 15=>"york=yellow",
25=>"gave=green", 30=>"battle=blue", 35=>"in=indigo",
40=>"vain=violet"];
var_dump($input);
array_splice($input, 2, 0, [10=>"of=orange"]);
var_dump($input);
gives this:
array (size=6)
5 => string 'richard=red' (length=11)
15 => string 'york=yellow' (length=11)
25 => string 'gave=green' (length=10)
30 => string 'battle=blue' (length=11)
35 => string 'in=indigo' (length=9)
40 => string 'vain=violet' (length=11)
array (size=7)
0 => string 'richard=red' (length=11)
1 => string 'york=yellow' (length=11)
2 => string 'of=orange' (length=9)
3 => string 'gave=green' (length=10)
4 => string 'battle=blue' (length=11)
5 => string 'in=indigo' (length=9)
6 => string 'vain=violet' (length=11)
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 2a02:c7f:dcf5:f400:f1d1:72d7:80ff:6d22)
----
Manual Page -- https://php.net/manual/en/function.array-splice.php
Edit -- https://main.php.net/note/edit/126019
Del: integrated -- https://main.php.net/note/delete/126019/integrated
Del: useless -- https://main.php.net/note/delete/126019/useless
Del: bad code -- https://main.php.net/note/delete/126019/bad+code
Del: spam -- https://main.php.net/note/delete/126019/spam
Del: non-english -- https://main.php.net/note/delete/126019/non-english
Del: in docs -- https://main.php.net/note/delete/126019/in+docs
Del: other reasons-- https://main.php.net/note/delete/126019
Reject -- https://main.php.net/note/reject/126019
Search -- https://main.php.net/manage/user-notes.php