- Code: Select all
$_PAGE = array(
'not_found' => array(
'name' => 'not_found',
'location' => 'page/notfound.php',
'title' => 'Page Not Found'
),
'home' => array(
'name' => 'home',
'location' => 'page/home.php',
'title' => 'Home'
));
And I can access it fine using $_PAGE['not_found'], but when I try to access it with $_PAGE[0] it doesn't work, can I only choose to use numbers or words for my key?
I looked at this -> http://php.net/manual/en/function.array-keys.php and by looking at that my code should work but it just returns with an error.
Error:
- Code: Select all
( ! ) Notice: Undefined offset: 0 in C:\www\include\script\function.php on line 35
Call Stack
# Time Memory Function Location
1 0.0002 672664 {main}( ) ..\home.php:0
2 0.0005 694392 do_header( ) ..\home.php:14
The code on line 35 is this
- Code: Select all
echo $GLOBALS['_PAGE'][0]['title'];
The code works when I put $GLOBALS['_PAGE']['not_found']['title'].
How can I use the words as keys and still be able to access it using the numeric keys?


