kintersect
The kintersect filter returns an array containing only the values that are in the first array whose keys are also in the second array. The values are not compared.
{% set myColors = {'blue': '5', 'red': '15', 'green': '2'} %}
{% set yourColors = {'red': '2', 'black': '3', 'green': '30'} %}
{% set same = myColors|kintersect(yourColors) %}
{# same is {'red': '15', 'green': '2'} #}
Arguments
The kintersect filter has the following signature.
kintersect(array)
Argument | Description |
---|---|
array | The array to intersect with the original value. |