input: Write a function to filter an array based on a given criteria. The function should iterate through the array, apply the criteria to each element, and return a new array containing only the elements that meet the criteria. If the 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, 6, 9, 12], lambda x: x % 3 == 0) == [3, 6, 9, 12]
  assert filter_array([2, 4, 6, 8, 10], lambda x: x % 2 == 0) == [2, 4, 6, 8, 10]
  assert filter_array([1, 3, 5, 7], lambda x: x % 2 == 0) == []
  assert filter_array([], lambda x: x % 5 == 0) == []
output: def filter_array(arr, criteria):
      return [x for x in arr if criteria(x)]