- htmlentities: documentation ( source)
- str_replace: documentation ( source)
- preg_replace: documentation ( source)
<?php
$string = 'HDO Intranet — Futar.png';
$encoded = htmlentities($string);
$encoded = str_replace(array('—'), array('-'), $encoded);
$result = preg_replace('/&([a-z]{1})[a-z]+;/i', '$1', $encoded);
echo $result;