Toggle navigation
Home
Code Snippets
Plain PHP
Doctrine
Laminas
Laravel
SQL
Symfony
Unittests
Other Libraries
Blog
Slides/Talks
@SenseException
Results of Array Spread Operator with explicit numeric keys in arrays
Code
<?php
$a
= [
1
=>
1
,
2
=>
2
];
$b
= [...
$a
,
3
=>
3
,
1
=>
4
];
dump
(
$b
);
Result
^
array:3
[
0
=>
1
1
=>
4
3
=>
3
]
More Snippets
Handling empty heaps
Predefined formats for DateTime class
Key Value pair in Generators
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8