You could probably do this many other ways but this is probably the best way as your not searching through the entire string but rather that first x characters
if (substr($string,0,7)=='http://')
{
//leave alone
}
else
{
$string = "http://".$string;
}