I want to require/include a file and retrieve its contents into a variable.
test.php
If your included file returned a variable...
...then you can assign it to a variable like so...
$abc = include 'include.php';
Otherwise, use output buffering.
ob_start(); include 'include.php'; $buffer = ob_get_clean();