input: Write a function to filter an array by a given criteria and return the filtered array. The criteria is a function that takes an element and returns a boolean indicating whether the element should be included in the filtered array. If the 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
  
  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, 23], criteria) == []
  assert filter_array([], criteria) == []
output: def filter_array(array, criteria):
      filtered_array = []
      for value in array:
          if criteria(value):
              filtered_array.append(value)
      return filtered_array