The easiest way to get the result you expect is in my opinion this way:
$data = array(
array(
'domain' => 'messages',
'key' => 'test.testik',
'message' => array()
),
array(
'domain' => 'messages',
'key' => 'test2313.tes31231tik',
'message' => array()
),
array(
'domain' => 'validators',
'key' => 'valid.validik',
'message' => array()
),
array(
'domain' => 'validators',
'key' => 'joga.jimbo',
'message' => array()
),
array(
'domain' => 'validators',
'key' => 'valid.validik',
'message' => array()
)
);
$newdata = array();
foreach ($data as $subdata) {
$newdata[$subdata['key']] = $subdata;
}
$newdata = array_values($newdata); // reset array indizes
print_r($newdata);
1
solved remove elemets from array where value of daughter array is equal [closed]