A user enters URLs in a box like this:
- google.net
- google.com
I then try to validate / check the URLs, so:
function check_input($data) {
$data = trim($data);
$data = mysql_real_escape_string($data);
return $data;
}
After validation:
$flr_array = explode("\n", $flr_post);
So, I can validate each URL. But mysql_real_escape_string finds spaces between URLs and adds:
<--print_r information-->
google.net\r\ngoogle.com
My URLs should and look like these:
- google.net
- google.com
How do I remove \r, because it breaks everything else?
Is there a better way to validate URLs?
Tried with str_replace, but no luck.
Thats where difference between single and double quotes comes into picture: