Is php's 'include' a function or a statement?

前端 未结 9 2068
梦谈多话
梦谈多话 2020-11-29 10:57

There are plenty of examples of both on the web. The php manual says \"The include() statement [...]\", which seems contradictory - if it\'s a statement shouldn\'t it not ha

相关标签:
9条回答
  • 2020-11-29 11:50

    I believe the only difference is what you want to do.

    For example, these two

    echo 'Hello World';
    echo ('Hello World');
    

    ...both print Hello World.

    It is just what you want to do, what you feel most comfortable with, and if you're like me, you want to make your script look pretty :D

    0 讨论(0)
  • 2020-11-29 11:51

    Statements having only one parameter, can have also parenthesis, e.g:

    echo ('hello world'); 
    
    0 讨论(0)
  • 2020-11-29 11:53

    include, require, echo, print, and a handful of other keywords are language constructs on their own, rather than function calls, and do not need parentheses. However, some people like to pretend they're function calls and use parentheses anyway. They are identical.

    0 讨论(0)
提交回复
热议问题