Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 23rd, 2012  |  syntax: None  |  size: 0.32 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. PHP Regex to Remove http:// from string
  2. $str = 'http://www.google.com';
  3. $str = preg_replace('#http://|https://#', '', $str);
  4. echo $str; // www.google.com
  5.        
  6. preg_match( "/^(https?://)?(.+)$/", $input, $matches );
  7. $url = $matches[0][2];
  8.        
  9. str_replace('http://', '', $subject);
  10. str_replace('https://', '', $subject);