input: Write a function to filter an array by a given criteria. The function should take an array and a criteria function as arguments, and return a new array containing only the elements that meet the given criteria. If the criteria is satisfied for an element, it should be included in the filtered array; otherwise, it should be excluded. If the input array is empty, the function should return an empty 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 = [4, 7, 9, 12, 18]
  assert filter_array(array, criteria) == []
  array = []
  assert filter_array(array, criteria) == []
  array = [5, 10, 15, 20, 25, 30]
  assert filter_array(array, criteria) == [5, 10, 15, 20, 25, 30]
output: def filter_array(array, criteria):
      filtered_array = []
      for value in array:
          if criteria(value):
              filtered_array.append(value)
      return filtered_array