input: Write a function to filter an array by a given criteria, where the criteria is a function that returns True or False. If the criteria function returns True for an element, that element should be included in the filtered array; otherwise, it should be excluded. Return the filtered array.
  
  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, 7, 12, 18, 23]
  assert filter_array(array, criteria)==[]
  
  array = [10, 15, 20, 25, 30]
  assert filter_array(array, criteria)==[10, 15, 20, 25, 30]
  
  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