input: Write a Python function to filter an array based on a given criteria and return the filtered array. The function should accept an array and a criteria function as inputs and return a new array with only the elements that satisfy the criteria.
  def filter_array(array, criteria):
   filtered_array = []
   for value in array:
    if criteria(value):
     filtered_array.append(value)
   return filtered_array
  
  def criteria(x):
   return x % 5 == 0
  
  # Test cases
  assert filter_array([1, 2, 5, 10, 15, 20, 25, 30], criteria) == [5, 10, 15, 20, 25, 30]
  assert filter_array([3, 6, 9, 12, 15], criteria) == [15]
  assert filter_array([7, 14, 21, 28], criteria) == []
  assert filter_array([], criteria) == []
  assert filter_array([5, 10, 15, 20, 25], criteria) == [5, 10, 15, 20, 25]
output: def filter_array(array, criteria):
   filtered_array = []
   for value in array:
    if criteria(value):
     filtered_array.append(value)
   return filtered_array