Home php Merge of php arrays

Merge of php arrays

Author

Date

Category

Hello, is it possible to combine arrays?

$ array [] = [1,2,3,4];
$ array1 [] = [5,6,7,8];
$ array2 [] = // at the output should be obtained [1,2,3,4,5,6,7,8]

Answer 1, Authority 100%

Of course, you can. Using Array_Merge :

$ array2 = array_merge ($ array, $ array1);

If numeric keys (as here, simply in an implicit form), in the resulting array will be all values.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions