What is the best practice for passing variables between pages in PHP when using include() to insert content into a layout page?

When using include() to insert content into a layout page in PHP, the best practice for passing variables between pages is to use the global keyword to make the variables accessible in both the included file and the layout file. By declaring the variables as global in the included file, they can be accessed and modified in the layout file without any issues.

// included file
global $variableName;
$variableName = "value";

// layout file
include('included_file.php');
echo $variableName;