Answers for "php clean string special characters"

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
$string = "DelftStack is a best platform.....";
echo "Output:  " . rtrim($string, ".");
?>
Posted by: Guest on April-23-2021

Code answers related to "php clean string special characters"

Browse Popular Code Answers by Language