3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [ 'color' => 'red', 'taste' => 'sweet', 'shape' => 'round', 'name' => 'apple' ]; $a += ['myKey' => 'foo']; // this is added because the key doesn't exist $a += ['shape' => 'bar']; // this is ignored because the already key exists $a += ['zero']; // this is added because the 0 key doesn't exist $a += ['not zero']; // this is ignored because the 0 key already exists var_export($a);
Output for 8.1.32, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
array ( 'color' => 'red', 'taste' => 'sweet', 'shape' => 'round', 'name' => 'apple', 'myKey' => 'foo', 0 => 'zero', )

preferences:
52 ms | 406 KiB | 5 Q