Answers for "how to remove special characters from json string 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
$mainstr = "@@PHP@Programming!!!.";
echo "Text before remove:\n" . $mainstr;
echo "\n\nText after remove: \n" . trim($mainstr, '@!.');
?>
Posted by: Guest on April-23-2021
0

Remove Special Character in PHP

phpCopy<?php
$mainstr = "This is a sim'ple text;";
echo "Text before remove: \n" . $mainstr, "\n";
$replacestr = remove_sp_chr($mainstr);
function remove_sp_chr($str)
{
    $result = str_replace(array("#", "'", ";"), '', $str);
    echo "\n\nText after remove: \n" . $result;
}
?>
Posted by: Guest on April-23-2021

Code answers related to "how to remove special characters from json string in php"

Browse Popular Code Answers by Language