3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $text = <<<TXT /some text/ TXT; $pattern = "/тест"; $pattern = mb_convert_encoding($pattern, 'UTF-8', 'Windows-1251'); $pattern = preg_quote($pattern, '/'); $pattern = mb_convert_encoding($pattern, 'Windows-1251', 'UTF-8'); var_dump($pattern); $matches = array(); $match = preg_match_all("/" . $pattern . "/mi", $text, $matches); var_dump($match, $matches);
Output for 4.3.4 - 7.1.0
string(10) "\/тест" int(0) array(1) { [0]=> array(0) { } }
Output for 4.3.2 - 4.3.3
Warning: mb_convert_encoding(): Illegal character encoding specified in /in/qur3A on line 10 Warning: mb_convert_encoding(): Unknown encoding "Windows-1251" in /in/qur3A on line 12 bool(false) int(14) array(1) { [0]=> array(14) { [0]=> string(0) "" [1]=> string(0) "" [2]=> string(0) "" [3]=> string(0) "" [4]=> string(0) "" [5]=> string(0) "" [6]=> string(0) "" [7]=> string(0) "" [8]=> string(0) "" [9]=> string(0) "" [10]=> string(0) "" [11]=> string(0) "" [12]=> string(0) "" [13]=> string(0) "" } }
Output for 4.3.0 - 4.3.1
Warning: mb_convert_encoding() [http://www.php.net/function.mb-convert-encoding]: Illegal character encoding specified in /in/qur3A on line 10 Warning: mb_convert_encoding() [http://www.php.net/function.mb-convert-encoding]: Unknown encoding "Windows-1251" in /in/qur3A on line 12 bool(false) int(14) array(1) { [0]=> array(14) { [0]=> string(0) "" [1]=> string(0) "" [2]=> string(0) "" [3]=> string(0) "" [4]=> string(0) "" [5]=> string(0) "" [6]=> string(0) "" [7]=> string(0) "" [8]=> string(0) "" [9]=> string(0) "" [10]=> string(0) "" [11]=> string(0) "" [12]=> string(0) "" [13]=> string(0) "" } }