Related questions
Remove multiple whitespaces
I'm getting $row['message'] from a MySQL database and I need to remove all whitespace like \n \t and so on.
$row['message'] = "This is a Text \n and so on \t Text text.";
should be formatted to:
$row['message'] = …
Replacing accented characters php
I am trying to replace accented characters with the normal replacements. Below is what I am currently doing.
$string = "Éric Cantona";
$strict = strtolower($string);
echo "After Lower: ".$strict;
$patterns[0] = '/[á|â|à|å|ä]/';
$patterns[1] = '/[ð|é|ê|è|ë]/';
$patterns[2] = '/[í|î|ì|ï]/';
$patterns[3] = '/[ó|ô|ò|ø|õ|ö]/';
$…
PHP remove special character from string
I have problems with removing special characters. I want to remove all special characters except "( ) / . % - &", because I'm setting that string as a title.
I edited code from the original (look below):
preg_replace('/[^a-zA-Z0-9_ -%][().][\/]/s', …