create search function for arrays