1、已有数组 $hobbies = ["r"=>"running", "f"=>"fishing", "c"=>"cooking"]; 修改键f的值为fishing2 输出修改后的数组
时间: 2024-04-22 20:20:03 浏览: 66
1Hobbies
要修改数组中键为"f"的值为"fishing2",使用以下代码:
```php
$hobbies["f"] = "fishing2";
print_r($hobbies);
```
输出结果为:
```
Array
(
[r] => running
[f] => fishing2
[c] => cooking
)
```
阅读全文