php strip out special characters
function clean($string) {
$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
}
Log in, to leave a comment
3
1
phpCopy<?php
$mainstr = "<h2>Welcome to <b>PHPWorld</b></h2>";
echo "Text before remove: \n" . $mainstr;
echo "\n\nText after remove: \n" .
str_ireplace(array('<b>', '</b>', '<h2>', '</h2>'), '',
htmlspecialchars($mainstr));
?>
Thank you!
1
0
Are there any code examples left?
New code examples in category PHP
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Relative searches
remove special characters from a word php
remove special characters except - php
remove special characters from string php regex
php remove special characters from string php
remove html special characters from string php
remove special characters except space from string php
remove special characters from string php but no space
not remove Special Characters array in php
remove special characters but allowed # and @from string php
how to hide special characters in php
php eliminate special chars
how to remove special characters from chinese language string in php
trim value with special chars php
php remove space and special characters from string
all special symbols remove from string php
strip special charachers from php array
string replace for remove the special characters from string in php
php remove one special characters
php how to remove special character from string at end
removing all special characters from a string in php
how to remove special characters from integer in php
how to remove special characters from a number in php
special characters remove in php
string remove special characters php
remove special characters from array value php
remove special char in php
remove all special characters from a string php
remove special characters from array values in php
remove special characters and characters from string php
html special characters remove in php
php remove special character ' remove
remove special character in php
php remove html special characters
php remove all special characters from string but keep dot
php remove all special characters from string except dot
php $_GET removing special characters
validate remove special characters from string php
remove special characters from string but keep space php
read string and stop at a special characters in php
remove all numbers and special chars from string php
trim special characters % in php
trim special characters in php
remove special characters using php
remove special character from php
how to remove all special characters from a string with its code #&039; in php
how to remove all special characters from a string with its code in php
remove string between special character php
php remove special characteres
remove all special characters except "&" in php
remove special characters from string in ph
php remove from array after special characters
php clear string from special characters
remove special characters from array php
remove special characters from string except comma in php
how to remove numbers and special characters from a string in php
php regex remove all special characters
how to remove special character in php
remove number and special character from string in php
strip off all special characters except comma php
remove special characters from string php without comma and dot
php strip all special charaters out of a string
special characters remove from string in php
remove numbers and special characters from string php
remove special characters from string regex php
php remove special characters from string function
string remove special chars php
php clean string from special characters
php remove special characters not space
word remove special characters php
php remove special characters out of an array
php remove spaces and special characters
html remove special characters in php
how to remove special character in php string
remove special characters from number php
trim special text symbols php
delete special char php
php remove special characters in the end of string
filter special characters php
how remove special characters in php
how to remove particular special character from string in php
can we trim special characters in php
php remove special symbol
php remove instead of converting special symbols
php clear special characters
php filter special characters from string
how to remove special character from string php
remove special characters in string in php
how to remove a special character from a string and put a space in php
php special characters remove
remove special character from string php
remove special characters from string and put in list php
remove special character from string in php
php remove all special char
php remove specific special characters in a field
php remove special characters in a field
php remove numberrs andd special characters
php filter special characters
how to remove special char in php
PHP remove special characters from string except dot
remove all special characters except / from string in php
php remove special caractere
php how to remove special characters from string
remove special char from string php
HTML input value remove special characters php
HTML <input value remove special characters php
hide special characters in string in php
php trim special characters
php remove all special characters from string except spaces
remove special characters regex php
php remove special characters except @
remove special character php
php function to remove special characters and spaces
php remove special carachters from string
how to remove all special characters from £sign with php
how to trim special character  in php
remove the special character from string in php
php form remove special characters
regex remove special characters php
php strip html special characters
how to remove html special characters from a string in php
remove all special characters from string in php
remove all special characters php
how to remove special characters from a string in php
remove special characters from string in php
php string remove special characters
php remove special characters from string except space
php remove special character
remove strip special charates php
php remove special charector
php remove special character from string
remove all spaces and special characters from string php
clear special characters php
remove all the special characters from a string in php
strip special characters in php
how to remove special characters php
php regex remove special characters
php remove all special chars from string
php remove special characters and spaces
remove special characters from text using php
remove special caracters php
remove all special characters and space from string php
Remove Special Character from String in PHP for
remove special string from string in php
clean string from special characters php
remove special letter in php to string
php remove spaces and special characters from string
remove special letter in php to string
remove special characters in php to string
remove special chars php
php strip all special characters from string
php remove email domain and special char
preg_match remove special characters
php remove all special character
strreplace regex special chars
striplashes php
php string to float remove currency symbol
remove special characters from string except & in php
which character should be removed in php
remove special chars from string php
php remove all ""
clean string in laravel
php replace spec sybols
php remove all special characters from string
laravel clean string
php replace special characters
php remove all special characters except @
php remove all special characters
php strip special characters
prelace spechial characters php
special characters full stop php
avoid all special characters regex php
clean string
php check if word in string has special characters and replace it multiple
remove all special characters from string php
remove special character email address php
php preg_replace remove special characters
special characters remove from query in php
strip all special characters php
strip special characters php
regex escape all special characters php
php remove special characters but pontuated text
php remove special characters but
php remove special chars
php escape special characters
remove special characters in php
how to remove special characters in php
how to remove the special charaters in php
php function to remove special characters
How to remove special characters from string in php
php delete special characters from string
php replace special characters in string
php replace all special characters in string
regular expressions to remove specific characters in laravel
php remove space html special characters from string
remove special characters php
replace all special characters in php
php regex remove all characters from url
remove special char from string in php
php string delete special characters
php remove special characters from string greek
php remove special characters
remove special characters from string php
php remove special characters from string
php strip out special characters