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'] = …
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', …
Replace preg_replace() e modifier with preg_replace_callback
I'm terrible with regular expressions. I'm trying to replace this:
public static function camelize($word) {
return preg_replace('/(^|_)([a-z])/e', 'strtoupper("\\2")', $word);
}
with preg_replace_callback with an anonymous function. I don't understand what the \\2 is doing. Or …