header("Location: http://example.com/newpage.php"); exit();
use Symfony\Component\HttpFoundation\RedirectResponse; $response = new RedirectResponse('http://example.com/newpage.php'); $response->send();
use Zend\Diactoros\Response\RedirectResponse; $response = new RedirectResponse('http://example.com/newpage.php'); return $response;In the above example, the RedirectResponse class from the Diactoros package of the Zend Framework is used to create a redirection response. The return statement is used to return the response to the user's browser and redirect them to the newpage.php page. Package/Library: Zend Diactoros package.