I'm using the below code to try and convert to slug and for some reason it's not echoing anything. I know I'm missing something extremely obvious. Am I not calling the function?
<?php
$string = "Can't You Convert This To A Slug?";
function clean($string) {
$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
echo $string;
}
?>