-2
<?php
array $food= array('healthy'=>
array('Salad','Vege',Pasta'),
'unhealthy'=>
array('pizza','icecream'));
echo $food['unhealthy'][1];
?>
我寫這個代碼,但讓瀏覽器的這個錯誤:多維數組與解析錯誤
error : Parse error: syntax error, unexpected '$food' (T_VARIABLE), expecting '(' in C:\xampp\htdocs\foreach.php on line 2
參見手冊如何定義一個基本陣列:http://php.net/manual/en/language.types.array.php – Rizier123