I am not sure if parentheses make difference or I am doing something wrong! Here is a situation I accidentally encountered..
print (FALSE or TRUE); //prints '1'
print FALSE or TRUE; //prints nothing
We know that FALSE or TRUE
evaluates to TRUE
, but surprisingly, printing TRUE
is not affected by parentheses!
print (TRUE); //prints '1'
print TRUE; //prints '1'
The manual mentions clearly that using parentheses is not required! Here is a quote from the manual..
print is not actually a real function (it is a language construct) so you are not required to use parentheses with its argument list.
What I want to know ..
- Is it a bug?
- If it is not a bug, how do parentheses affect the output?
- Which way gives expected output, using parentheses or omitting them?
I am using PHP Version 5.4.7 on Windows 8.
Thanks!