$result = array_reduce(
$data,
function($res, $el) {
if (isset($res[$el["id_product_attribute"]])) {
$res[$el["id_product_attribute"]] .= ", " . $el["attribute_name"];
} else {
$res[$el["id_product_attribute"]] = $el["attribute_name"];
}
return $res;
},
[]
);
var_export($result);