Skip to content

Instantly share code, notes, and snippets.

@plasticbrain
Created October 10, 2012 07:34
Show Gist options
  • Save plasticbrain/3863749 to your computer and use it in GitHub Desktop.
Save plasticbrain/3863749 to your computer and use it in GitHub Desktop.
PHP: (REGEX/preg_match) check for http(s)://
//--------------------------------------------------------------------------
// See if a url contains http:// or https://
//--------------------------------------------------------------------------
if( !preg_match('/http(s?)\:\/\//i', $url) ) {
// URL does NOT contain http:// or https://
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment