Skip to content
Advertisement

Change array keys of nested array on multidimensional array from integer to alphabet

JavaScript

I trying to get each nested array from 0..x to be converted to alphabet. So for example ‘topic’ is ‘A’, and ‘orgkey’ is ‘F’.

Then return a new multidimensional array (‘A’ => array(‘A’ => ‘My topic name’, ‘B’ => ’12/11/2018 16:30:00′)) and so forth.

Advertisement

Answer

Make an array of the alphabet and loop through the array, replacing the key with the letter of the alphabet at the same index.

https://paiza.io/projects/_ICIlEET4tieXtsN4MF4rw

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