1

I m curious to know that is there any diffrence between

header('Location:index.php'); // using  capital  `L`
exit(); // using parenthesis

AND

header('location:index.php');
exit;

which one we should recommend to use?

0

2 Answers 2

4

According to the actual RFC for HTTP, you should use an uppercase "L", and an absolute URI:

header('Location: http://www.mysite.com/index.php');

As far as exit vs exit(), there is no difference. It is a language construct, not a function, and the parenthesis are optional. You may even use exit 0 or exit(0).

Sign up to request clarification or add additional context in comments.

2 Comments

Section 4.2 says that field names are case-insensitive. However, it's conventional to use initial capitals.
Whitespace after the colon is also preferred, but not required. Again, read section 4.2.
0

There is no difference between exit; and exit();

and the Location should be written with a capital L

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.