<?php
$options = [
'rootNode' => 'response'
];
// array_merge
// the same key appearing later will overwrite
echo print_r(array_merge(['rootNode' => 'root'], $options), true);
/**
* output
*
* Array
* (
* [rootNode] => response
* )
*/
// + syntax if it already exists + will NOT overwrite
echo print_r(['rootNode' => 'root'] + $options, true);
/**
* Output
*
* Array
* (
* [rootNode] => root
* )
**/
0 Comments