I have an associative array declared in a file as follows:
<?php $players = array (
'catcher' => 'Brian McCann',
'firstBase' => 'Eddie Mathews',
'secondBase' => 'Ozzie Albies',
'shortstop' => 'Andrelton Simmons',
'thirdBase' => 'Chipper Jones',
'leftField' => 'Dale Murphy',
'centerField' => 'Andruw Jones',
'rightField' => 'Ronald Acuna Jr',
'designatedHitter' => 'Hank Aaron',
'pitcher1' => 'Greg Maddux',
'pitcher2' => 'John Smoltz',
'pitcher3' => 'Tom Glavine',
'pitcher4' => 'Warren Spahn',
'pitcher5' => 'Tim Hudson',
'closer' => 'Craig Kimbrel',
); ?>
Immediately after this I have an include statement for a PHP file in which I need to use this array.
<?php include './framework/component/allTime_team.php'; ?>
I attempted to use <?php echo $players['catcher']; ?>
when I needed to use one of the values but I received no output. I then tried <?php var_dump($player['catcher']); ?>
and received NULL
as the output.
How do I access the data in this array?