Special character removal from string – PHP

function string_clean($string) { $string = str_replace(‘ ‘, ‘-‘, $string); // Replaces all spaces with hyphens.