Skip to content
Advertisement

Use explode on array?

What’s the easiest way to turn the array

JavaScript

into

JavaScript

Is there something built-in with laravel/collections that I can use?

I know I can make a foreach loop and use explode and populate a new array, but I’m wondering if there is a built-in function in PHP or a laravel collections method I can use.

Advertisement

Answer

I think you’re looking for combine (or the PHP equivalent array_combine)

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