Answers for "php remove special characters and spaces"

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 symbolsand spaces php

preg_replace('/[^A-Za-z0-9]/', "", $data)
Posted by: Guest on December-14-2020

Code answers related to "php remove special characters and spaces"

Browse Popular Code Answers by Language