0

Created by potrace 1.16, written by Peter Selinger 2001-2019

Creating URL from Title error in Php Local Environment

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

Created by potrace 1.16, written by Peter Selinger 2001-2019

Imtiyaz Mohammed

25 September, 2024

# php comment

Related Plugins