Skip to content
Advertisement

Implode array with array of glue strings

I have a awkward need but I need to interleave an array with another array before imploding the result. I guess my better option would be less talk more example

Array number one

JavaScript

Array number two

JavaScript

I need to produce

JavaScript

My question is can I do that with an implode or I must build my own function?

Advertisement

Answer

Adapted from comment above.

Are you sure you don’t just want string formatting?

JavaScript

Output:

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