Answers for "how to remove special charaters from array in php"

PHP
0

Remove Special Character in PHP

phpCopy<?php
function RemoveSpecialChar($str)
{
    $res = preg_replace('/[0-9\@\.\;\" "]+/', '', $str);
    return $res;
}
$str = "My name is  hello and email [email protected];";
$str1 = RemoveSpecialChar($str);
echo "My UpdatedString: ", $str1;
?>
Posted by: Guest on April-23-2021
0

Remove Special Character in PHP

phpCopy<?php
$str = "@@HelloWorld";
$str1 = substr($str, 1);
echo $str1 . "\n\n";
$str1 = substr($str, 2);
echo $str1;
?>
Posted by: Guest on April-23-2021
0

Remove Special Character in PHP

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));
?>
Posted by: Guest on April-23-2021

Code answers related to "how to remove special charaters from array in php"

Browse Popular Code Answers by Language