function twig_array_merge in Translation template extractor 6.3
Same name and namespace in other branches
- 7.3 vendor/Twig/Extension/Core.php \twig_array_merge()
Merges an array with another one.
<pre> {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %}
{% set items = items|merge({ 'peugeot': 'car' }) %}
{# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #} </pre>
Parameters
array $arr1 An array:
array $arr2 An array:
Return value
array The merged array
1 string reference to 'twig_array_merge'
- Twig_Extension_Core::getFilters in vendor/
Twig/ Extension/ Core.php - Returns a list of filters to add to the existing list.
File
- vendor/
Twig/ Extension/ Core.php, line 683
Code
function twig_array_merge($arr1, $arr2) {
if (!is_array($arr1) || !is_array($arr2)) {
throw new Twig_Error_Runtime(sprintf('The merge filter only works with arrays or hashes; %s and %s given.', gettype($arr1), gettype($arr2)));
}
return array_merge($arr1, $arr2);
}