input: Write a function to filter an array by a given criteria. The function should iterate through the array and check each element against the criteria. If the element matches the criteria, it should be added to a new list which will be returned as the result. If the array is empty, the function should return an empty list.
  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, 7, 8], lambda x: x % 2 == 1) == [1, 3, 7]
  assert filter_array([], lambda x: x > 0) == []
  assert filter_array([10, 20, 30, 40], lambda x: x > 50) == []
  assert filter_array([5, 10, 15, 20, 25, 30], lambda x: x % 10 == 0) == [10, 20, 30]
output: def filter_array(arr, criteria):
      return [x for x in arr if criteria(x)]