remove whitespace and bracket php code example Example: remove whitespace from string php $str = "\n\n\nHello World!\n\n\n"; echo "With trim: " . trim($str);