Below I've got a tiny bit of all my coding, this is the thing I need. $linkurl is just a regular url.
I want this code so the possible http://
or https://
won't be in the link before i put it in my database. It's a fault prevention for when people add http://
themselves so you can't get urls with http://http://
in the database.
if (strpos($linkurl,'http://') !== false){
$linkurl-http://=$linkurl
}
The problem is, I don't know what to type in the if
statement.
You can replace the http://
and https://
with this sinppet of code, using regular expressions.
$linkurl = 'http://example.com'; //Works for https too
$replaced = preg_replace('@(http://|https://)@i', '', $linkurl);
echo $replaced;