is there a sensible way of removing ALL fields from an array APART from ones that I specify?
I’m thinking something along the lines of array_diff could work, but I only want to list the field keys that I want to allow, and then say ‘drop everything else’. What’s the best way of doing that?
Many thanks
array_intersect_key() should work if copying the array is OK.
Otherwise, you can use a foreach loop: