Remove Special Character in PHP code example
Example 1: Remove Special Character in PHP
phpCopyWelcome to PHPWorld";
echo "Text before remove: \n" . $mainstr;
echo "\n\nText after remove: \n" .
str_ireplace(array('', '', '', '
'), '',
htmlspecialchars($mainstr));
?>
Example 2: Remove Special Character in PHP
phpCopy 'Dave',
'Dave' => ':name2 or :password',
':name2' => 'Steve',
':pass' => '7hf2348', ];
echo "\n" . strtr($strTemplate, $strParams) . "\n";
echo "\n" . str_replace(array_keys($strParams), array_values($strParams), $strTemplate) . "\n";
?>
Example 3: Remove Special Character in PHP
phpCopy "-", "hello" => "hi", "hi" => "hello");
echo "Output: " . strtr($str, "e", "h");
?>