Posted By

bluecap on 08/13/14


Tagged

httpurlphppregmatchregex


Versions (?)

Add http:// to URLs if missing


 / Published in: PHP
 

This snippet will add http:// to URLs if necessary. Source: http://stackoverflow.com/questions/6240414/add-http-prefix-to-url-when-missing

  1. if (preg_match("#https?://#", $aProfileInfo['Website']) === 0) {
  2. $aProfileInfo['Website'] = 'http://'.$aProfileInfo['Website'];
  3. }

Report this snippet  

You need to login to post a comment.