Page 1 of 1

Re: Why can't I access this array?

Posted: Sat Oct 13, 2012 11:16 pm
by simplypixie
As you have used names for your keys (i.e. 'not_found' => array....), you are replacing the numeric references to your array values and will only be able to access them using the string as the reference.

If you change it to:

Code: Select all

$_PAGE = array(
   array(
      'name' => 'not_found',
      'location' => 'page/notfound.php',
      'title' => 'Page Not Found'
   ),
   
   array(
      'name' => 'home',
      'location' => 'page/home.php',
      'title' => 'Home'
   ));
You can access using the numeric keys - try print_r($_PAGE) on the code above and your existing code and you will see the difference.