While it's a popular saying associated with him, there's no definitive evidence that he actually said or wrote it.
However, the quote's wit and cynical nature align perfectly with Wilde's style and themes, making it a fitting addition to his repertoire of famous pronouncements.