1 array merge
how to implement it? Thank you!
array(3) {
[0] => array(7) {
["game_name"] => string(18) ""
["game_icon"] => string(32) "game_icon_wx0913c2de2ce8376a.png"
["id"] => int(1)
["gift_name"] => string(15) ""
["gift_details"] => string(23) "*5000 *100"
["need_score"] => int(30)
["gift_type"] => int(2)
}
[1] => array(7) {
["game_name"] => string(18) ""
["game_icon"] => string(32) "game_icon_wx0913c2de2ce8376a.png"
["id"] => int(2)
["gift_name"] => string(15) ""
["gift_details"] => string(25) "*50000 *1000"
["need_score"] => int(120)
["gift_type"] => int(2)
}
[2] => array(7) {
["game_name"] => string(18) ""
["game_icon"] => string(32) "game_icon_wx945daf05d01dad39.png"
["id"] => int(3)
["gift_name"] => string(12) ""
["gift_details"] => string(8) "*1"
["need_score"] => int(50)
["gift_type"] => int(1)
}
}
modify to:
array(3) {
[0] => array(7) {
["game_name"] => string(18) ""
["game_icon"] => string(32) "game_icon_wx0913c2de2ce8376a.png"
["gift"]=>array(2){
[0]=>array(5){
["id"] => int(1)
["gift_name"] => string(15) ""
["gift_details"] => string(23) "*5000 *100"
["need_score"] => int(30)
["gift_type"] => int(2)
}
[1]=>array(5){
["id"] => int(2)
["gift_name"] => string(15) ""
["gift_details"] => string(25) "*50000 *1000"
["need_score"] => int(120)
["gift_type"] => int(2)
}
}
}
[2] => array(7) {
["game_name"] => string(18) ""
["game_icon"] => string(32) "game_icon_wx945daf05d01dad39.png"
["gift"]=>array(2){
[0]=>array(){
["id"] => int(3)
["gift_name"] => string(12) ""
["gift_details"] => string(8) "*1"
["need_score"] => int(50)
["gift_type"] => int(1)
}
}
}
}
array code, I don"t bother to write it. Give me a JSON array! Convenient installation and replacement test
[
{
"game_name": "",
"game_icon": "game_icon_wx0913c2de2ce8376a.png",
"id": 1,
"gift_name": "",
"gift_details": "*5000 *100",
"need_score": 30,
"gift_type": 2
},
{
"game_name": "",
"game_icon": "game_icon_wx0913c2de2ce8376a.png",
"id": 2,
"gift_name": "",
"gift_details": "*50000 *1000",
"need_score": 120,
"gift_type": 2
},
{
"game_name": "",
"game_icon": "game_icon_wx945daf05d01dad39.png",
"id": 3,
"gift_name": "",
"gift_details": "*1",
"need_score": 50,
"gift_type": 1
}
]