Hi, I am having trouble while creating URL's from the title, below is the code which is working in online editor but not working in my local dev environment.
public static function uri($url) {
# Prep string with some basic normalization
$url = strtolower($url);
$url = strip_tags($url);
$url = stripslashes($url);
$url = html_entity_decode($url);
# Remove quotes (can't, etc.)
$url = str_replace('\'', '', $url);
# Replace non-alpha numeric with hyphens
$match = '/[^a-z0-9]+/';
$replace = '-';
$url = preg_replace($match, $replace, $url);
$url = trim($url, '-');
return $url;
}
Please advice how to fix it!
0
Imtiyaz Mohammed
25 September, 2024