PHP : How to insert an array into other child array by same index?
Posted
by
airi
on Stack Overflow
See other posts from Stack Overflow
or by airi
Published on 2013-10-23T03:49:43Z
Indexed on
2013/10/23
3:53 UTC
Read the original article
Hit count: 152
i am new to array. Hope you can help me. i have 2 array. Let say:
array 1 = [[50,60],[70,80]]
array 2 = ["Fire", "Marine"]
array 1 index : Array([0]=>Array ([0]=>50 [1]=>60) [1]=>Array ([0]=>70 [1]=>80))
array 2 index : Array ([0]=> Fire [1]=>Marine)
How i can insert array 2 into array 1 like output below :
Output that i want like below:
array 3 = [["Fire",50,60],["Marine",70,80]]
array 3 index = (Array([0]=>Array ([0]=>Fire [1]=>50 [2]=>60) [1]=>Array ([0]=>Marine [1]=>70 [2]=>80))
Thanks
© Stack Overflow or respective owner