Alternative to mysql_real_escape_string without connecting to DB

Well, according to the mysql_real_escape_string function reference page: 'mysql_real_escape_string() calls MySQL'slibrary function mysql_real_escape_string, which escapes the followingcharacters: x00, n, r, , ', ' and x1a.'

function mres($value){ $search = array('\', 'x00', 'n', 'r', ''', ''', 'x1a'); $replace = array('\\','\0','\n', '\r', ''', ''', '\Z'); return str_replace($search, $replace, $value);}