Add http before url in php

function addhttp($url) {
    if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
        $url = "http://" . $url;
    }
    return $url;
}

Comments

Popular posts from this blog

Creating Protected routes in ReactJS

Redirect http to https in codeigniter