intersect Twig Filter

The intersect filter returns an array containing only the values that are in both arrays.

This filter is unique to Aptuitiv. It is not part of the core Twig functionality.
{% set myPets = ['dog', 'cat', 'snake', 'elephant', 'fish'] %}
{% set yourPets = ['snake', 'camel', 'fish', 'shark'] %}
{% set samePets = myPets|intersect(yourPets) %}
{# samePets is ['snake', 'fish'] #}

Arguments

The intersect filter has the following signature.

intersect(array)
Argument Description
array The array to intersect with the original value.
This documentation is only for Aptuitiv CMS. Learn more.
Get Started With Aptuitiv