Hi, I have this function: function safe($data) { $data = str_replace("\r", '', $data); $data = str_replace("\n", '', $data); $data = str_replace("\t", ' ', $data); $data = str_replace('’', '\'', $data); $data = str_replace('‘', '\'', $data); $data = str_replace('“', '"', $data); $data = str_replace('&', '&', $data); $data = str_replace('£', '£', $data); $data = strtr($data, "¥µÀÃÂÃÄÅÆÇÈÉÊËÌÃÃŽÃÃÑÒÓÔÕÖØÙÚÛÜÃßà áâãäåæçèéêëìÃîïðñòóôõöøùúûüýÿ", "YuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy"); return $data; } PHP: Which is to make content safe on return and strip out anything i don't want. But it is not taking out the /r or /n and i don't know why. This is the text which i am trying it on. <strong>Lorem Ipsum</strong> is simply dummy text of the printing and\r\ntypesetting industry. Lorem Ipsum has been the industry\'s standard\r\ndummy text ever since the 1500s, when an unknown printer took a galley\r\nof type and scrambled it to make <br><br>a type specimen book. It has survived\r\nnot only five centuries, but also the leap into electronic typesetting,\r\nremaining essentially unchanged. It was popularised in the 1960s with\r\nthe release of Letraset sheets containing Lorem Ipsum passages, and\r\nmore recently with desktop publishing software like Aldus PageMaker\r\nincluding versions of Lorem Ipsum. Does anyone have any ideas why this is not working? Cheers, Adam Code (markup):
If you LITERALLY want to remove \r and \n, then you have to put these between single quotes. $data = str_replace('\r', '', $data); $data = str_replace('\n', '', $data); $data = str_replace('\t', ' ', $data); PHP: \n between double quotes means a new line character. Which is the same as hitting the enter button when you're editing the source code. The (real) new line character and the graphical representation \n are NOT the same.