input: Write a function to filter an array by a given criteria. The function should take two arguments: an array and a criteria function. The criteria function will be used to evaluate each element in the array. If the element matches the criteria, it should be included in the filtered output. The function should return the filtered array. Implement the criteria function to filter elements divisible by 5.
  
  
  # 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
  
  result = filter_array([1, 2, 5, 10, 15, 20, 25, 30], criteria)
  print(result) # Outputs [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