Assigning contents to a variable with include/require_once

The assignment from an =include() call will only get you a possible return value from that script, not any output.

To make this possible you would have to modify the include script to capture the output:

 <?php
      ob_start();

      ...

      return ob_get_clean();
 ?>

$var = require_once('lol.php'); will only put the return value of the file into $var. If you don't return anything from it, it'll just be null.

If you want the output you will need to use output buffering:

ob_start();
require_once('lol.php');
$var = ob_get_clean();