$url_name = str_replace(\" \",\"-\",$entry[\'department_name\']);
$url_name = str_replace(\" & \",\"-amp-\",$entry[\'department_name\']);
Hi iam re
Is this what you want? Note I'm using str_replace here with the search/replace args as arrays to save you doing multiple calls to str_replace()
$search = array(' & ', ' ');
$replace = array('-amp-', '-');
$url_name = str_replace($search, $replace, $entry['department_name']);
Put the amp replacement first.
$url_name = str_replace(" & ","-amp-",$entry['department_name']);
$url_name = str_replace(" ","-",$url_name);