// 创建一个关联数组来存储数据 $data = array( “name” => “John”, “age” => 30, “city” => “New York” );
// 输出数组中的某个值
echo "Name: " . $data[‘name’] . “
”;
echo "Age: " . $data[‘age’] . “
”;
echo "City: " . $data[‘city’] . “
”;
// 修改数组中的某个值 $data[‘age’] = 31;
// 输出修改后的值
echo "Updated age: " . $data[‘age’] . “
”;
// 遍历整个数组并输出键值对
foreach ($data as $key => $value) {
echo $key . ": " . $value . “
”;
}