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

前端 未结 9 2097
梦谈多话
梦谈多话 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条回答
  •  猫巷女王i
    2020-11-29 11:48

    The parentheses are parameters for a function. With include you can use it either as a function or a statement in php.

    Because include() is a special language construct, parentheses are not needed around its argument.

    Documentation here: http://php.net/manual/en/function.include.php

    With echo same concept, quoting from the PHP manual here

    echo is not actually a function (it is a language construct), so you are not required to use parentheses with it. echo (unlike some other language constructs) does not behave like a function, so it cannot always be used in the context of a function.

提交回复
热议问题