Use of 'standalone parentheses'

Posted by zaf on Stack Overflow See other posts from Stack Overflow or by zaf
Published on 2010-05-05T11:43:02Z Indexed on 2010/05/05 11:48 UTC
Read the original article Hit count: 111

Filed under:
|

I just answered a question where I advised removing parentheses around a statement and was asked why, to which I had no answer when I realised that it caused no errors/warnings. I could only cite bad practice. But maybe I'm the one missing something...

I did my own tests:

(print('!')); // Outputs '!'
((print('!!'))); // Outputs '!!'
(1); // No output
(qwerty); // No output
(1==2); // No output
(1=2); // Syntax error
// etc...

Can someone shed some light on whats going on and of what use are 'standalone parentheses'?

© Stack Overflow or respective owner

Related posts about php

Related posts about syntax