Answers for "not remove Special Characters array in php"

PHP
1

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.
}
Posted by: Guest on December-09-2020
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 = "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
0

Remove Special Character in PHP

phpCopy<?php
$str = "ei all, I said eello";
//$trans = array("h" => "-", "hello" => "hi", "hi" => "hello");
echo "Output:  " . strtr($str, "e", "h");
?>
Posted by: Guest on April-23-2021

Code answers related to "not remove Special Characters array in php"

Browse Popular Code Answers by Language