As you know, PHP is server-side, and can't change things when they're on the client-side. Of course, you can have it redirect instantly by sending
header("Location: newpage.htm");
die();
at the beginning, if that was what you're looking for. But during the "lifetime" of a page, only client-side things like JavaScript can change the location.