這是我的數組:取代PHP數組的所有鍵
['apple']['some code']
['beta']['other code']
['cat']['other code 2 ']
我怎麼能代替所有的「E」字母「!」在鍵名,並保留值 ,這樣我會得到類似的東西
['appl!']['some code']
['b!ta']['other code']
['cat']['other code 2 ']
我發現這一點,但因爲我沒有相同的名稱所有密鑰我不能用它
$tags = array_map(function($tag) {
return array(
'name' => $tag['name'],
'value' => $tag['url']
);
}, $tags);
你的陣列不被清除,是多維或者關聯數組,請更新您的實際陣列 –