Skip to content

Instantly share code, notes, and snippets.

@zillingen
Last active December 25, 2017 08:40
Show Gist options
  • Save zillingen/7c0e844af4626a0d3eec17ffc5543f58 to your computer and use it in GitHub Desktop.
Save zillingen/7c0e844af4626a0d3eec17ffc5543f58 to your computer and use it in GitHub Desktop.
PHP все подряд
<?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