This file contains 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 | |
/** | |
* composer require phpbench/phpbench | |
* php vendor/bin/phpbench run CachingBench.php --report=default | |
*/ | |
/* | |
PhpBench 0.13.0. Running benchmarks. | |
\CachingBench |
This file contains 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 | |
function strip_word_html( | |
$text, | |
$allowed_tags = '<a><ul><li><b><i><sup><sub><em><strong><u><br><br/><br /><p><h2><h3><h4><h5><h6>' | |
) { | |
mb_regex_encoding('UTF-8'); | |
//replace MS special characters first | |
$search = array('/‘/u', '/’/u', '/“/u', '/”/u', '/—/u'); | |
$replace = array('\'', '\'', '"', '"', '-'); | |
$text = preg_replace($search, $replace, $text); |
This file contains 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 | |
// http://nob-log.info/2012/04/12/phper-filter-validate-email/ | |
$times = 10000; | |
$result = array(); | |
// preg_match | |
// regexp is stolen from: | |
// https://github.com/php/php-src/blob/master/ext/filter/logical_filters.c#L525 |