PHP URL verification and if not valid fix it
<p>I am trying to verify URLs. This is the code I have:</p>

<pre><code>function isValidURL($url) 
{
    return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url);
}
</code></pre>

<p>This code is working but now I am trying to work out how to add <code>http://</code> or <code>https://</code> if the URL is correct but is just missing the beginning <code>http://</code></p>

<p>Please point me in the right direction.</p>
