If echo can work withouth the parentheses why exit can’t?
If echo can work withouth the parentheses why exit can’t?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
They’re both language constructs (T_ECHO and T_EXIT), but different kinds. You can use exit without parentheses, but not if you’re passing a value. Another quirk is that echo requires you not to use parentheses if you pass more than one value:
If you’re now thinking, “But that doesn’t really explain why the design is inconsistent”, welcome to PHP.