Skip to content
Advertisement

How to change date format in multidimensional array and iterate all array with key

I have a multidimensional array with key and value and some key is empty also. Then I want to set a value for internal not empty array.

JavaScript

I had this array but I want to set return_time 00:00 all over array. I tried foreach loop but foreach is remove empty array but I want empty array also.

I want this type array:-

JavaScript

Advertisement

Answer

Try this foreach again, I think it will solve your problem if I understood you correctly.

JavaScript

It will change return_time to “00:00” and also retain the empty index to your array.

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