input: Write a function to filter an array by a given criteria and return the filtered array. If the given array is empty then 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([7, 14, 21, 28], lambda x: x % 7 == 0) == [7, 14, 21, 28]
  assert filter_array([1, 3, 5, 7, 9], lambda x: x % 2 != 0) == [1, 3, 5, 7, 9]
  assert filter_array([], lambda x: x % 3 == 0) == []
output: def filter_array(arr, criteria):
      if not arr:
          return []
      return [x for x in arr if criteria(x)]