Write a function to perform basic operations on an array.
Implement array_operations(arr, operation, value=None, index=None). Return a new array for append, insert, delete, and reverse; return the first matching index for search, or -1 if absent. Examples: ([1, 2], "append", 3) returns [1, 2, 3]; ([4, 5, 4], "search", 4) returns 0. Assume valid operation names and indices, with array length from 0 to 10^4.
def array_operations(arr, operation, value=None, index=None):