public static function removeAttributes(string $html, array $attributes = []) : string
{
// Default set of attributes
static $default = ['id', 'class'];
// If no attributes are given, the default set will be used
if (empty($attributes)) {
$attributes = $default;
}
// Remove given attributes
foreach ($attributes as $attribute) {
$html = preg_replace('~(<[a-z][a-z0-9]*[^>]*?)\\s+' . $attribute . '="[^"]*"~is', '\\1', $html);
}
return $html;
}