combind search group and merge group PHP