Perform queries on PHP arrays