Last active
December 25, 2017 08:40
-
-
Save zillingen/7c0e844af4626a0d3eec17ffc5543f58 to your computer and use it in GitHub Desktop.
PHP все подряд
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 | |
// Show Errors | |
error_reporting(E_ALL); | |
ini_set("display_errors", 1); | |
/** | |
* Cyrillic to Latin transliteration via PHP Transliterator class | |
*/ | |
$rus = 'привет'; | |
$tr = Transliterator::create('Russian-Latin/BGN'); | |
print $lat = $tr->transliterate($rus); // show privet | |
/** | |
* Remove css classes and id from html | |
*/ | |
function clearHtml($html) { | |
$pattern = '/(?<=class=[\"\']|id=[\"\'])([^\'\"]*)(?=[\"\'])/mi'; | |
$replacement = ''; | |
$html = preg_replace($pattern, $replacement, $html); | |
return $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment