input: Write a function to filter an array by a given criteria. The criteria should be a function that returns True or False for each element in the array. The function should return a new array containing only the elements that satisfy the criteria. If the input array is empty, the function should return an empty array.
  
  # Function to filter an array by a given criteria
  def filter_array(array, criteria):
   # Create an empty list
   filtered_array = []
   # Iterate through the array
   for value in array:
    # Check if it matches the criteria
    if criteria(value):
     # If it matches, add it to the list
     filtered_array.append(value)
  
   # Return the filtered array
   return filtered_array
  
  # Input criteria
  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, 9, 11], 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