Skip to content

Instantly share code, notes, and snippets.

@akamola
Last active November 5, 2016 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akamola/7c94ace522508adb60e6468147523a05 to your computer and use it in GitHub Desktop.
Save akamola/7c94ace522508adb60e6468147523a05 to your computer and use it in GitHub Desktop.
PHP: Check if a URL does not contain "http://" or "https://"
<?php
if ( ( strpos( $url, 'http://' ) === false ) && ( strpos( $url, 'https://' ) === false ) ) {
$url = 'http://' . $url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment