I am working through an older php mysql book written in 2003. The author uses the include() function to construct html pages by including header.inc, footer.inc, main.inc files, etc. Now I find out that this is not allowed in the default ini settings, (allow_url_include is set to Off) after I got many warnings from the server.
I noticed also that you can use include without the parenthesis. I tried this and it works and I get no error messages or warnings. Are the two different? That is, is include() different from include ?
This is a misunderstanding. You can turn off the inclusion of remote files (using a URL http://www.example.com/include.php
instead of a filesystem path). You can always include local files.
The latter is because include
is not a normal function, but a language construct. Like die
, it can be used with or without parentheses. Source: Manual
Because include() is a special language construct, parentheses are not needed around its argument. Take care when comparing return value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With