Skip to content

Instantly share code, notes, and snippets.

@condor-bird
Last active May 12, 2018 16:46
Show Gist options
  • Save condor-bird/6ca9a1b102b5420e1e10b599ce4c4924 to your computer and use it in GitHub Desktop.
Save condor-bird/6ca9a1b102b5420e1e10b599ce4c4924 to your computer and use it in GitHub Desktop.
PHP notes
<?php
preg_replace("/http:\/\/.*?\//", "", $string);
preg_replace("@^https?://[^/]+/@", "", $string);
//delete all attribute html
preg_replace("#(</?\w+)(?:\s(?:[^<>/]|/[^<>])*)?(/?>)#ui", '$1$2', $html);
$html = preg_replace_callback('~(?<=<code>).*?(?=</code>)~s',
function($m) {
return htmlentities($m[0]);
}, $html);
(?s)(?<=<code>).*?(?=<\/code>)
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment