Hey Artisan,Hello Folks,
In this example, I will show you php string remove special characters. I’m going to show you about php remove special characters from string. I would like to show you how to remove special characters from a string in php. We will look at an example of remove special characters from string php. Follow the below tutorial step of remove some special characters from string php.
In this example, i will give you very simple example of how to remove special characters from a string in php. we will use preg_replace()
index.php
<?php
$str = "Hello, How are you $##%% my friends?";
$cleanString = preg_replace('/[^A-Za-z0-9 ]/', '', $str);
echo $cleanString;
?>
Output:
Hello How are you my friends
I hope it can help you...
Do you like below Tutorials ?
- Laravel 7.x and 6.x Ajax Multiple Image Upload with Preview Example
- Laravel select with count(*) using db raw example
- PHP Laravel select with join subquery example
- PHP Laravel Ajax Form Submit Example
- How to create events for created/updated/deleted model task in Laravel 5?
- Angular JS Form Validation Example Code
- AngularJS - Confirm Password Validation Example
- Laravel Ajax Request using X-editable bootstrap Plugin Example