Skip to content
Advertisement

replace all keys in php array

This is my array:

JavaScript

how can I replace all the “e” letters with “!” in the key name and keep the values so that I will get something like that

JavaScript

I found this but because I don’t have the same name for all keys I can’t use It

JavaScript

Advertisement

Answer

I hope your array looks like this:-

JavaScript

If yes then you can do it like below:-

JavaScript

output:- https://eval.in/780144

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement