array_diff Filter
Compares the array against another array based on its values. This method will return the values in the original array that are not present in the given array. Original keys are preserved. Chain the array_values
filter to get just the new values.
{{ [1,2,3,4,5]|array_diff([2,4,6,8])|json_encode }}
{# {"0":1,"2":3,"4":5} #}
{{ [1,2,3,4,5]|array_diff([2,4,6,8])|array_values|json_encode }}
{# [1,3,5] #}