I want to achieve this kind of array using PHP.
[
{
"url": "https://url1.com",
"code": "BNXl421s"
},
{
"url": "https://url2.com",
"code": "BNKpt1L2"
},
{
"url": "https://url3.com",
"code": "BMwhPRih"
}
]
While i have these arrays :
$urls =
[
"https://url1.com",
"https://url2.com",
"https://url3.com"
]
$codes=
[
"BNXl421s",
"BNKpt1L2",
"BMwhPRih"
]
I tried writing 2 foreach statements but it duplicates results since I had no idea how to achieve that.