php include returns 1 as output with other outputs [closed]

First of all, this is not WordPress-specific, and does therefore not belong in WordPress.StackExchange. As it’s so easy to answer, however…

include is not a function, but it does return whatever you put in “return” inside the file that’s included. You can use an output buffer to “catch” all output:

ob_start();
include TEMPLATEPATH . '/apex.php';
$html .= ob_get_clean();