Link to home
Start Free TrialLog in
Avatar of Brant Snow
Brant Snow

asked on

PHP using and referencing arrays

So i have my two examples below, the first one is working but what i really want is the second one but i cant seem to get it to work.
<?php
$section = array(
"first" => "its the first",
"second" => "its the second"
);

echo( $section["first"] ); /* this will print out 'its the first' What i really want is below but cant get it to work*/

?>

<?php
/* i cant get this to work but it is what i want */
$section = array(
"first" => ["its the first","im still first","3rd part of first"],
"second" => ["its the second","im still second","3rd part of second"]
);

echo( $section["first"][2] ); /* this should print out "3rd part of first"*/

?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of zappafan2k2
zappafan2k2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Chris Harte
Chris Harte
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brant Snow
Brant Snow

ASKER

great