View file File name : sl_cat.php Content :<?php session_start(); include("../include/config.php"); include("../include/functions.php"); //include("../include/simpleimage.php"); //echo "<pre>==ff="; //print_r($csvArr);die; //validate_admin(); error_reporting(E_ALL); ini_set('display_errors', '1'); $string = "Eggholic - Indian Veg & Egg Street Food"; $string1 = "Bombay Eats - Bombay & Wraps (Wells)"; //$string = str_replace(' - ', ' ', $string1); //echo $slug = strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $string))); $string2 = "habibi-med-grill-(w-armitage-ave)-(old-name)"; $string3 = "nepal-house-indian-&-nepalese-cuisine"; $string5 = "aangan-(2701-&-#-[broadway] )-]-$%&*@~"; $string6="3m Bar & Grill InC."; $string7= "Buff Patty Restaurant And Bakery - Fort Greene"; $string8 = "South Indian & Dosas"; echo $slug = sanitize_slug($string); $store_identifier= str_replace( array( "'",'"' ),'',$slug); $slug= strtolower($store_identifier); echo $store_slug = str_replace(' ', '-', $slug); die; // Function to remove the special function RemoveSpecialChar($str) { // Using str_replace() function // to replace the word $res = str_replace( array( '\'', '"', ',' , ';', '<', '>' ), ' ', $str); // Returning the result $res = str_replace(' - ', '-', $res); $slug = strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $res))); return $slug; } function sanitize_slug($text) { $text = preg_replace('/[^A-Za-z0-9-]+/', '-', $text); $text = trim($text, '-'); $text = preg_replace('~-+~', '-', $text); return strtolower($text); } function sanitize_slug2($text) { $text = preg_replace('/[^A-Za-z0-9-]+/', '-', $text); $text = trim($text, '-'); $text = str_replace('&', '&', $text); $text = preg_replace('~-+~', ' ', $text); return strtolower($text); } ?>