// 这里用数字来作为索引
$myArray = array(2012, 'blue', 5, 'BMW'); // 这个用关键字作为索引
$myAssocArray = array('year' => 2012,
'colour' => 'blue',
'doors' => 5,
'make' => 'BMW'); // This code will output "blue".
echo $myArray[1];
echo '<br />';
echo $myAssocArray['colour'];
//循环输出数组结果
foreach ($myAssocArray as $ingredient=>$include) {
echo $include . ' ' . $ingredient . '<br />';
} //数组里面有数组
$deck = array(array('2 of Diamonds', 2),
array('5 of Diamonds', 5),
array('7 of Diamonds', 7));
//输出 You have the 7 of Diamonds!
echo 'You have the ' . $deck[2][0] . '!';
05-04 03:38