regular expression to make slug for local language
//this slug with encoding for any language
function CleanURL($string, $delimiter = '-') {
// Remove special characters
$string = preg_replace("/[~`{}.'\"\!\@\#\$\%\^\&\*\(\)\_\=\+\/\?\>\<\,\[\]\:\;\|\\\]/", "", $string);
// Replace blank space with delimeter
$string = preg_replace("/[\/_|+ -]+/", $delimiter, $string);
return $string;
}
$slug=CleanURL($request->title);
$post->slug=$slug;
Are there any code examples left?
New code examples in category Other