FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » when incuding a page
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: when incuding a page [message #184297 is a reply to message #184215] Fri, 20 December 2013 17:57 Go to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
Christoph Michael Becker wrote:

> Fyndhorn Elder wrote:
>> richard <noreply(at)example(dot)com> writes:
>>> <?php inlcude "page.html" ?>
>> […]
>> The correct syntax is include("string") or include('string literal')
>
> include is not a function, but a statement, so the parentheses are not
> required.

The fascinating thing about “include” is that it works like a function
although it is a statement. If the include is successful, it returns 1 by
default, otherwise FALSE. And if the include is successful, and the
included PHP script contains a “return” statement, then the value of the
“return” statement's parameter (for lack of a better word) is the return
value of „include“ if execution reaches that statement.

However, in general it is considered good style to omit the parentheses.
It is considered even better style to avoid include* and require* when
possible, in favor of autoloading.

See also:

<http://php.net/include>
<http://pear.php.net/manual/en/standards.including.php>
<http://pear.php.net/manual/en/pear2cs.rules.php>
<http://php.net/autoload>

Unfortunately, so far the difference between function-like statements and
functions has never been made clear using different, but consistent code
style in the PHP manual.


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: working model of the latest project
Next Topic: Include gives warning
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 16:22:24 GMT 2024

Total time taken to generate the page: 0.04540 seconds