Global regularity and stability of solutions to elliptic equations with nonstandard growth