Q:

php main file not seeing included file variable

OK most the answers on S.O. are BACKWARDS from what I am having an issue with. My variable is not seen FROM the included file. I have never ran into this, and it is messing everything up. I was using smarty, but since it cant see the var, I went back to old fashion php templating, and still cannot see the var.. here is the scripts in question (a gaming site ofc).
INCLUDED FILE: prep_feature_game.php
foreach($games->gamexml->game as $game){

        $d = parseDate($game['releasedate']);
        $game['date_month'] = $d['month'];
        $game['date_day'] = $d['day'];
        $game['date_year'] = $d['year'];
        $game['image_60x40'] = showImage($game['foldername'],'60x40');
        $game['genrelist'] = displayGenreList($game['gameid']);

        //debugPrint($game);die();
        $game_list[] = $game;       

    }

CONTROL PAGE:
switch ($page) {

        default:
            include('includes/prep_feature_game.php');
            // NOTE $GAME_LIST HAS THE ARRAY ^
            display('feature_game');
            break;

AND THE DISPLAY FILE: FEATURE_GAME.PHP
    <h1><?=SITE_NAME;?>'s Featured Games!</h1>

    <table>
    <?PHP
    // TEST FOR $GAME_LIST
    foreach($game_list as $field=>$data){
      echo $data['gamename'];
    }
/*
this produces the error:
Notice: Undefined variable: game_list in C:\xampp\htdocs\ix2\themes\missingpiece\feature_game.php on line 7
*/

 }// end switch page

I have many variations over the years of these templates, and the "included" files have never produced this kind of error. I know that included files act as though the script contained is inserted where the include is at. 
why is the receiving script unable to see the variable produced from the included script. These are all included, so it should not be an issue
PS
I noticed this started happening when I upgraded from php v5 - php v7, doubt it has anything to do with that, I havent checked that yet since include files are pretty standard.

A:

Your question is not showing the definition of the display function, but unless you declare $game_list as a global within that function it is out of scope.  If you include the template it'll work.
include('includes/prep_feature_game.php');
include('feature_game.php');

Or add parameters to your display function.
display('feature_game', $game_list);

Or if you're using smarty you must assign the variable first.
$smarty->assign('game_list', $game_list);
$smarty->display('feature_game.tpl');

