i have created bellow array
businesscommercialArray = {
40E: {
id: 94,
swift_code: "40E",
status: 1
},
43P: {
id: 106,
swift_code: "43P",
status: 2,
note: "Allowed (INSTEAD OF EXISTING)"
}
},
27: {
id: 106,
swift_code: "27",
status: 2,
note: "Allowed"
}
}
i trying to loop through this array and if the status found as 2 means there is a note added. from there i want to take the key and note values to new array. like bellow
$finalarray = {
swift_code: "40E",
note: ""
},
{
swift_code: "43P",
note: "Allowed (INSTEAD OF EXISTING)"
},
{
swift_code: "27",
note: "Allowed"
}
so far i managed to loop though it but not able to access the key and values
foreach($businesscommercialArray as $key => $values) {
foreach($values as $key => $value)
{
print_r($value);
}
}