Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

http_redirect() vs header() [duplicate]

Possible Duplicate:
php header location vs php_redirect

Throughout the years I've been using PHP I've always redirected to another URL via the header('Location: example.com') function. Today while browsing php.net I've noticed there is a function specifically for redirection called http_redirect()

Are there any benefits to using http_redirect() to header() or vice versa?


References:

  1. http://www.php.net/manual/en/function.header.php
  2. http://php.net/manual/en/function.http-redirect.php
like image 931
Zaki Aziz Avatar asked Jan 29 '13 19:01

Zaki Aziz


1 Answers

While http_redirect() does some things for you (such as exit, clear output buffers and sends a generic redirection body), it is not a standard function (it comes as part of an extension that's not even a pre-loaded one) and therefore you can't really rely on it being available.

like image 137
Niet the Dark Absol Avatar answered Nov 06 '22 16:11

Niet the Dark Absol