On Thu, May 9, 2013 at 9:22 PM, Tim Starling <tstarling(a)wikimedia.org>wrote;wrote:
include and require return a value, so they are more
like functions
than return or print. See e.g. ResourceLoader.php:
$this->register( include( "$IP/resources/Resources.php" ) );
You could compare them to pseudo-functions like empty and isset. I
suppose you could write:
$this->register( include "$IP/resources/Resources.php" );
But that looks kind of weird to me.
True, but you also have to be careful about that. As mentioned in the PHP
docs, this can lead to weird operator precedence results. For example,
if ( include( "$IP/resources/Resources.php" ) === false ) {
will not work as expected. It looks like a quick check to see if the
included file was successfully included, but PHP will first evaluate the
=== operator before the include statement.
*-- *
*Tyler Romeo*
Stevens Institute of Technology, Class of 2015
Major in Computer Science
www.whizkidztech.com | tylerromeo(a)gmail.com