Last active
May 12, 2018 16:46
-
-
Save condor-bird/6ca9a1b102b5420e1e10b599ce4c4924 to your computer and use it in GitHub Desktop.
PHP notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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