Strip Characters From Tag Name

Here it how you can do it.

$tag = 'medical & health';
$tag_class = preg_replace('/[^A-Za-z0-9-]+/', '-', html_entity_decode($tag));
echo '<li><a class="'.$tag_class.'" href="https://wordpress.stackexchange.com/questions/108491/javascript:void(0)">' .$tag. '.</a></li>';

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)