Answers for "remove special characters from string except & 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
-1

trim | from right in php

$DATA=trim("abc|1|test|","|");
Posted by: Guest on December-18-2020

Code answers related to "remove special characters from string except & in php"

Browse Popular Code Answers by Language