Hello guys if you want to remove all special chareters like (& # @ % , ' ! ) etc every thing then this post is really helpful for you .
Watch below example :
My string is like this "Lakeside Landing , RV Resort & Marina" and in my case i want to remove & , and space with '-' so i write code like below
$heading = "Lakeside Landing , RV Resort & Marina";
$heading= ereg_replace("[^A-Za-z0-9]", "-",$heading) ;
Output : Lakeside-Landing---RV-Resort---Marina
In this hyphen is come more than one times .So now again i want to only single '-' .So i write again this code.
$heading= preg_replace('/-+/', '-', $filter_heading);
Now i return this Output : Lakeside-Landing-RV-Resort-Marina
Watch below example :
My string is like this "Lakeside Landing , RV Resort & Marina" and in my case i want to remove & , and space with '-' so i write code like below
$heading = "Lakeside Landing , RV Resort & Marina";
$heading= ereg_replace("[^A-Za-z0-9]", "-",$heading) ;
Output : Lakeside-Landing---RV-Resort---Marina
In this hyphen is come more than one times .So now again i want to only single '-' .So i write again this code.
$heading= preg_replace('/-+/', '-', $filter_heading);
Now i return this Output : Lakeside-Landing-RV-Resort-Marina