Welcome! Log In Create A New Profile

Advanced

[PHP-DEV] Semicolon not required if statement on next line

Posted by Abdul Haque Sheikh 
Abdul Haque Sheikh
[PHP-DEV] Semicolon not required if statement on next line
July 30, 2018 09:50AM
why not to make semicolon not required if there is only 1 statement like
javascript.
semicolon will be required if there are multiple statements on the same
line.
On Monday, July 30, 2018 at 2:45 AM Abdul Haque Sheikh <[email protected]> wrote:

> why not to make semicolon not required if there is only 1 statement
> like javascript. semicolon will be required if there are multiple
> statements on the same line.

Because this "feature" of JavaScript leads to confusing code and unintended bugs
(see examples at https://codeburst.io/why-i-prefer-to-use-semicolon-in-javascript-f00c303547).
Many JS projects end up relying on a linter to require semicolons and avoid these issues.

The fact that PHP requires semicolons is one of the things I like about the language.

Best regards,
Theodore Brown
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login