在PHP中包含文件时,哪种语法更好? [重复]

This question already has an answer here:

Some people include files like this:

include ('file.php');

and some people include files like this:

include 'file.php';

I think here the use of brackets is completely unnecessary. What are your views? Which style is better and why?

</div>

When brackets are unnecessary, it's better to remove them (Same for the return instead of return () which give better performances). Probably the same for includes.

http://php.net/manual/en/function.return.php

Note: Note that since return is a language construct and not a function, the parentheses surrounding its arguments are not required. It is common to leave them out, and you actually should do so as PHP has less work to do in this case.

Moreoever, using whole path for your include is better than just relative.

It's somewhat irrelevant as the parser accepts both (hence I suspect you most likely have more pressing concerns), but if you want to be correct you should use it without brackets, as include is a statement not a function.

As per the PHP include manual page (emphasis mine):

The include statement includes and evaluates the specified file.