Remove special character in php

technical talkiess
0

 <?php

$str = 'today I \'ll learn PHP and the day with awsome.';

$str1 = 'This is a bad command so donot put here  : del c:\\*.*';


echo RemoveSpecialChar($str);

echo "<br/>";

echo RemoveSpecialCharinphp($str1);

function RemoveSpecialCharinphp($str)

{

    $string1= preg_replace('/[0-9\@\.\;\""]+/', '', $str);

    return $string1;

}

?> 


Out put of the code

1) today I 'll learn PHP and the day with awsome

2) This is a bad command so donot put here : del c:\**

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)