remove special character in php

Solutions on MaxInterview for remove special character in php by the best coders in the world

showing results for - "remove special character in php"
Brahim
28 Apr 2016
1phpCopy<?php
2function RemoveSpecialChar($str)
3{
4    $res = preg_replace('/[0-9\@\.\;\" "]+/', '', $str);
5    return $res;
6}
7$str = "My name is  hello and email hello.world598@gmail.com;";
8$str1 = RemoveSpecialChar($str);
9echo "My UpdatedString: ", $str1;
10?>
11
Rébecca
10 Jun 2020
1phpCopy<?php
2$str = "@@HelloWorld";
3$str1 = substr($str, 1);
4echo $str1 . "\n\n";
5$str1 = substr($str, 2);
6echo $str1;
7?>
8
Côme
29 Sep 2016
1phpCopy<?php
2$mainstr = "<h2>Welcome to <b>PHPWorld</b></h2>";
3
4echo "Text before remove: \n" . $mainstr;
5
6echo "\n\nText after remove: \n" .
7    str_ireplace(array('<b>', '</b>', '<h2>', '</h2>'), '',
8    htmlspecialchars($mainstr));
9?>
10
Nadia
24 Jan 2019
1phpCopy<?php
2$mainstr = "@@PHP@Programming!!!.";
3echo "Text before remove:\n" . $mainstr;
4echo "\n\nText after remove: \n" . trim($mainstr, '@!.');
5?>
6
Noa
28 Nov 2020
1phpCopy<?php
2$string = "DelftStack is a best platform.....";
3echo "Output:  " . rtrim($string, ".");
4?>
5
Martina
04 Nov 2018
1phpCopy<?php
2$str = "geeks";
3$str = ltrim($str, 'g');
4echo $str;
5?>
6
Jan
25 Jun 2020
1phpCopy<?php
2$mainstr = "This is a sim'ple text;";
3echo "Text before remove: \n" . $mainstr, "\n";
4$replacestr = remove_sp_chr($mainstr);
5function remove_sp_chr($str)
6{
7    $result = str_replace(array("#", "'", ";"), '', $str);
8    echo "\n\nText after remove: \n" . $result;
9}
10?>
11
Mattia
20 Jan 2017
1phpCopy<?php
2$str = "ei all, I said eello";
3//$trans = array("h" => "-", "hello" => "hi", "hi" => "hello");
4echo "Output:  " . strtr($str, "e", "h");
5?>
6
Charley
15 May 2016
1phpCopy<?php
2$strTemplate = "My name is :name, not :name2.";
3$strParams = [
4    ':name' => 'Dave',
5    'Dave' => ':name2 or :password',
6    ':name2' => 'Steve',
7    ':pass' => '7hf2348', ];
8echo "\n" . strtr($strTemplate, $strParams) . "\n";
9echo "\n" . str_replace(array_keys($strParams), array_values($strParams), $strTemplate) . "\n";
10
11
12?>
13
queries leading to this page
remove special characters string phphow to remove special character in phpphp remove instead of converting special symbolsphp remove special characters from string except 40remove special characters from perticular feild from array in phphall special symbols remove from string phpclean special characters phpremove double special character in phphtml remove special characters in phpremove special character from string phpregex php remove special charactersremove all special characters from string in phpremove special character in string phpremove special characters except phpphp remove special unicode charactersremove special characters from string and put in list phpremocve special caracter phpremove special characters from variable phpremove html special characters in phpphp how to remove special character from string at endhow to remove all special characters from a string with its code 23 26039 3b in phptrim special characters in phpphp strip out special charactersremove special characters but allowed 23 and 40from string phpphp remove accents and special charactersphp remove special symbolhow to remove a special character from a string and put a space in phpremove special characters from string phpr n special characters remove phpphp remove special charactereshow to remove all special characters from a string in phpremove special characters from string regex phptrim value with special chars phpremove special characters in string in phpphp regex to remove special charactersphp remove all special charactersremove special characters in php strip special charachers from php arrayremove the special character from string in phpregex remove special characters phphow to remove special characters from chinese language string in phpremove special characters from array values in loop in phpphp strip all special charaters out of a stringphp remove one special charactersphp string remove special charactersphp clean string special charactersremove numbers and special characters from string phpremove all special characters from a string phpremove special characters from string in phphp remove special characters from string www3php remove special character 27 removephp regex remove all special characterscan we trim special characters in phpremove special characters phpremove special characters from array value phpphp remove all special characters from stringremove all changes after special characters phpnot remove special characters array in phptrim special characters 25 in phpdelete special char phpclean string from special characters phpremove all special characters except 22 26 22 in phpphp how to remove special characters from stringhow to remove the special character from a string in phpremove special character from string in phpremove any special character string phpremove special character from phpremove special characters from a string php laraveldelete character special phpremove special characters from number phpremove all numbers and special chars from string phpremove special characters from string in phphow to hide special characters in phphow to remove special character in php stringfilter special characters phpremove special characters using phpphp delete special characters from stringphp 24 get removing special charactersphp remove special characters from stringphp remove from array after special charactersremove special characters and characters from string phpignore special characters in phpremove special text in phpphp remove specific special characters from stringphp special characters removephp remove special charactershide special characters in php stringremove special characters from a word phpremove all special characters and space from string phpremove the special character from json string in phpphp remove special caphp eliminate special characters in submited valuephp remove special charaterphp remove all special characters from string but keep dotphp eliminate special charsremove all special characters in english from string phpphp strip special charactersphp clear string from special charactersspecial character getting removed in phphtml special characters remove in phpstring remove special characters phpstring replace for remove the special characters from string in phphow to remove special character from string in phpphp regex remove special charactershow to remove special characters from integer in phpremove number and special character from string in phpphp filter special characters from stringphp clear special charactersfunction to remove all special characters from string phpremove html special characters from string phpphp remove special characters from string functionhow to remove special characters from a number in phpphp remove special characters from filephp remove any special characters from stringhow remove special characters in phpspecial characters remove in phpphp remove html special charactersvalidate remove special characters from string phpinvisible special character phpremoving all special characters from a string in phpspecial characters remove from string in phpremoving special characters from string in phpphp remove special charsremove special characters from array values in phphow to remove special characters in phphow to remove special character from string phpword remove special characters phphow to remove numbers and special characters from a string in phpstring remove special chars phpphp remove special characters from string phpstrip special characters phpremove special character in phpremove all special characters from string phphow to remove special characters from a string in phpremove special char in phphow to hide special characters from array in phpremove special characters from array phphow to remove special characters tags from string phpphp remove all special charhow to remove all special characters from a string with its code in phphow to remove all special character from string in phpphp remove special characters out of an arrayhow to remove particular special character from string in phpphp remove 26eacute special charactersphp remove special characters in the end of stringremove string between special character phpphp clean string from special charactersremove special characters from string php regexremove special chars phpremove special characters from string php libraryregex to remove special characters phpremove special character in php