How can I replace in this array [userid] => 14 with [address] => some_address
Can’t find a way to rename a key.
Array ( [userid] => 14 [country_code] => ES [country_name] => España [country_url] => espana [city_name] => Zapateros [city_url] => zapateros [region_name] => Albacete [region_url] => albacete )
rpkamp
2
You can’t. You remove the old key and add the new key:
unset($array['userid']);
$array['address'] = 'some_address';
1 Like
You can add another key with new elements .
system
Closed
4
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.