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 ?
- Multidimensional Array Search By Value in PHP
- Laravel Install Font Awesome Icons Example
- How to Use Moment JS in Laravel?
- Angular 9 Get Environment Variables Example
- Angular Delete a Component From Cli Example
- How to Upload File from Local to Server using SSH?
- Angular Use CKEditor Example Tutorial
- How to Use Multiple Select Dropdown in Laravel?