Are there any alternative methods to capture outputs from a PHP file into a variable besides ob_start and ob_get_contents?

When capturing outputs from a PHP file into a variable, besides using ob_start() and ob_get_contents(), another alternative method is to use output buffering functions like file_get_contents() or include the PHP file and capture its output using output buffering with ob_get_clean().

// Using file_get_contents to capture output from a PHP file into a variable
$output = file_get_contents('your_php_file.php');
echo $output;

// Using include and ob_get_clean() to capture output from a PHP file into a variable
ob_start();
include 'your_php_file.php';
$output = ob_get_clean();
echo $output;