On 05/07/2021 15:35, Nikita Popov wrote:
The actual echo syntax is echo "Foo". PHP allows you to write echo("Foo")
in the same way it allows you to write echo((((("Foo"))))). Don't do it :)


Indeed. Note that this is valid:

echo "hello", " ", "world";

But this is not:

echo("hello", " ", "world");


I have in the past had a bug make it into production because the parentheses around a call to "include" were mis-placed because of this incorrect belief that it is "function-like":

if ( include('some_file.php') && bar() )

Is equivalent to this (will always run bar(), then attempt to include either (string)true or (string)false):

if ( include ('some_file.php' && bar()) )

When what was intended was this:

if ( (include 'some_file.php') && bar() )


Regards,

--
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to