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 of the array and returns True or False.
  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([3, 6, 9, 12], lambda x: x % 3 == 0) == [3, 6, 9, 12]
  assert filter_array([1, 4, 9, 16, 25], lambda x: x % 4 == 0) == [4, 16]
  assert filter_array([], lambda x: x >= 0) == []
  assert filter_array([-3, -2, -1, 0, 1, 2, 3], lambda x: x < 0) == [-3, -2, -1]
output: def filter_array(arr, criteria):
      return [x for x in arr if criteria(x)]