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

前端 未结 9 2102
梦谈多话
梦谈多话 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:45

    include is a statement : Explain by following eg

    // won't work, evaluated as include(('vars.php') == 'OK'), i.e. include('')
    if (include('vars.php') == 'OK') {
        echo 'OK';
    }
    
    // works
    if ((include 'vars.php') == 'OK') {
        echo 'OK';
    }
    

提交回复
热议问题