input: Write a function to filter an array by a given criteria. The function should take an array and a criteria function as input and return a new array containing only the elements that match the criteria. If the criteria function returns True for an element, that element should be included in the filtered array; otherwise, it should be excluded. If the input array is empty, the function should return an empty array.
  assert filter_array([1, 2, 5, 10, 15, 20, 25, 30], lambda x: x % 5 == 0) == [5, 10, 15, 20, 25, 30]
  assert filter_array([3, 7, 11, 16, 21], lambda x: x % 2 == 0) == [16]
  assert filter_array([], lambda x: x > 0) == []
output: def filter_array(arr, criteria):
      return [x for x in arr if criteria(x)]