input: Write a function to filter an array by a given criteria. The function should return a new list containing only elements that meet the specified criteria. The criteria is passed as a function, which should return True if an element should be included in the result and False otherwise.
  
  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
  
  assert filter_array([1, 2, 5, 10, 15, 20, 25, 30], criteria) == [5, 10, 15, 20, 25, 30]
  assert filter_array([3, 7, 12, 18], criteria) == []
  assert filter_array([5, 10, 15], criteria) == [5, 10, 15]
  assert filter_array([], criteria) == []
  assert filter_array([20, 22, 24, 25], criteria) == [20, 25]
output: def filter_array(array, criteria):
   filtered_array = []
   for value in array:
    if criteria(value):
     filtered_array.append(value)
   return filtered_array