I know how to prove
But what about we have different size of AP matrix?
This follows from the fact that $\operatorname{rank}(X) = \operatorname{rank}(X^T)$ for all matrices $X$. Hence $$ \operatorname{rank}(AP) = \operatorname{rank}((AP)^T)=\operatorname{rank}(P^TA^T)=\operatorname{rank}(A^T)=\operatorname{rank}(A), $$ since $P^T$ is invertible, and because of what you already know.
We can use the result $\mathrm{rank}(AB)\leq\mathrm{min}\{\mathrm{rank}(A),\,\mathrm{rank}(B)\}$ as follows:
$\mathrm{rank}(A) = \mathrm{rank}(A\underbrace{PP^{-1}}_{=I}) \leq \mathrm{rank}(AP) \leq \mathrm{rank}(A).$
Thus $\mathrm{rank}(AP) = \mathrm{rank}(A).$