input: Write a function to filter an array by a given criteria. The function should return the filtered array where each element matches the criteria. If the array is empty or no elements match the criteria, an empty list should be returned.
  
  assert filter_array([1, 2, 5, 10, 15, 20, 25, 30], lambda x: x % 5 == 0)==[5, 10, 15, 20, 25, 30]
  assert filter_array([1, 2, 3, 4, 6, 7, 8, 9], lambda x: x % 5 == 0)==[]
  assert filter_array([], lambda x: x % 5 == 0)==[]
  assert filter_array([1, 2, 3, 4, 5, 10, 15], lambda x: x % 3 == 0)==[3, 15]
output: def filter_array(arr, criteria):
      return [x for x in arr if criteria(x)]