input: Write a function to filter an array by a given criteria. The criteria is a function that returns True if a number matches the criteria, and False otherwise. The function should return the filtered array based on 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
  
  array = [1, 2, 5, 10, 15, 20, 25, 30]
  assert filter_array(array, criteria)==[5, 10, 15, 20, 25, 30]
  
  array = [3, 6, 10, 12, 15]
  assert filter_array(array, criteria)==[10, 15]
  
  array = [100, 105, 110, 115, 120]
  assert filter_array(array, criteria)==[100, 105, 110, 115, 120]
  
  array = [1, 2, 3, 4, 5]
  assert filter_array(array, criteria)==[5]
  
  array = []
  assert filter_array(array, criteria)==[]
output: def filter_array(array, criteria):
   filtered_array = []
   for value in array:
    if criteria(value):
     filtered_array.append(value)
   return filtered_array