Page 1 of 1

include().

Posted: Wed Aug 08, 2007 7:57 pm
by JellyFish
Does include return the file's contents?

For example:

Code: Select all

$var = include('somethingfile');
What would $var equal?

Posted: Wed Aug 08, 2007 8:03 pm
by volka
http://de2.php.net/include wrote:Handling Returns: It is possible to execute a return() statement inside an included file in order to terminate processing in that file and return to the script which called it. Also, it's possible to return values from included files. You can take the value of the include call as you would a normal function. This is not, however, possible when including remote files unless the output of the remote file has valid PHP start and end tags (as with any local file). You can declare the needed variables within those tags and they will be introduced at whichever point the file was included.

Posted: Wed Aug 08, 2007 8:58 pm
by s.dot
Why not try it? :)

Code: Select all

$var = include 'somethingfile';
var_dump($var);