My professor said in class that if we consider $R^n$ as an $R$-module, we get a bijection from the $\operatorname{End}(R^n)$ to the set of $n\times n$ matrices since we can regard any such homomorphism as a linear map from the vector space defined by $R^n$ onto itself.
But what I don't get is the following, he said that this bijection is not a ring homomorphism, but there is a ring isomorphism between $\operatorname{End}(R^n)$ to $M_n(R^\mathrm{op})$ where $R^\mathrm{op}$ is the opposite ring.
I know why this is true for a trivial module $M$ over $R$ where $M = R$. However I fail to see how this is the case for $R^n$ since I can simply identify a homomorphism from $R^n$ onto itself with a matrix, can anyone explain the technical details for how the opposite ring comes into the picture?
Thanks.