Either capture everything printed in the include file through output buffering
ob_start(); include 'yourFile.php'; $out = ob_get_contents(); ob_end_clean();
or, conversely, set the return value in a script, for example
// included script return 'foo'; // somewhere else $foo = include 'yourFile.php';
See example 5 http://de2.php.net/manual/en/function.include.php
source share