考虑一段这样的 php 代码:
$example = array ( 'Location' => 'farm', 'Name' => 'billy', 'Meal' => array());
$example['Meal'] = array('Fruit' = > 'apple', 'Soup' => 'tomato', 'Drink' => 'wine');
是否有任何好处或理由预先定义像这样的“膳食”子数组,而不是简单地编写:
$example = array ( 'Location' => 'farm', 'Name' => 'billy');
$example['Meal'] = array('Fruit' = > 'apple', 'Soup' => 'tomato', 'Drink' => 'wine');