$ \newcommand{\cat}{\mathbf} \newcommand{\RR}{\mathrm R} $
If there exist a morphism $$f:\RR \rightarrow [0,+\infty] ,f : x\mapsto x^2+1$$ in a category $\cat{Set}$. In particular, $f$ is not injective nor a surjective.
In the category of $\cat{Set^{op}}$, the $f$ change into $$f^{op}:[0,+\infty]\rightarrow \RR $$
This raises a question : $$f^{op}:x\mapsto ??? $$
The definition must satisfy that: $$ \cat {(C^{op})^{op}} = \cat C $$
The morphism $f^{\mathrm{op}}$ is still the same function as $f$. In a category, the morphisms can be anything; they don't need to be functions. (For example, think about treating a poset like a category: there, the morphisms aren't functions either.) In particular, it is perfectly allowed to make up a category $\mathsf C$, where the objects of $\mathsf C$ are sets, and a morphism $f: X \to Y$ is actually a function $f: Y \to X$. (Can you see what composition has to be?) Then, the category $\mathsf C$ is just $\mathsf{Set}^{\mathrm{op}}$.