Codice PHP:
if(substr($str,0,7) != 'http://') {
   
$str 'http://'.$str;

o

Codice PHP:
$str = (substr($str,0,7) != 'http://') ? 'http://'.$str $str