Use array_replace to merge attributes