How I can remove all elements of an array that contain just whitespace, not whitespace in an element like \"foobar \" but just empty array elements like <
This code takes advantage of the callback parameter for array_filter. It will loop the array, call trim() on the value, and remove it if the resulting value evaluates to false. (which an empty string will)