I have a form that inputs url
dynamically, the user may input
www.stack.com or
www.stack.com/overflow or
http://www.stack.com or
http://www.stack.com/overflow
how can I prevent to insert the duplicate entry to my database?
I’ve tried these
$url = (input url)
$search = str_replace("http://www.", "", $url);
$search = str_replace("http://", "", $url);
$search = str_replace("www.", "", $url);
$search = str_replace("/", "", $url);
at the last $search, I wanted to remove all the following character after “/” including “/”
what does follow?
For some who will stuck with the same question and drop here, here’s the complete code for this