3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $text = "Some test text string with stop-words: stw stw2 stopword stw3stw stopword2c"; $stopwords = array( 'stw', 'stopword' ); $regexp = '(' . implode('|', $stopwords) . ')'; var_dump($regexp); mb_regex_encoding('UTF-8'); var_dump(mb_regex_encoding()); $initResult = mb_ereg_search_init($text); var_dump($initResult); $totalResult = mb_ereg_search($regexp, "imz"); var_dump($totalResult); while(mb_ereg_search()) { $r = mb_ereg_search_getregs(); var_dump($r, mb_ereg_search_getpos()); mb_ereg_search_setpos(mb_ereg_search_getpos()); var_dump(mb_ereg_search_getpos()); }
Output for 4.3.4 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(14) "(stw|stopword)" string(5) "UTF-8" bool(true) bool(true) array(2) { [0]=> string(3) "stw" [1]=> string(3) "stw" } int(46) int(46) array(2) { [0]=> string(8) "stopword" [1]=> string(8) "stopword" } int(56) int(56) array(2) { [0]=> string(3) "stw" [1]=> string(3) "stw" } int(60) int(60) array(2) { [0]=> string(3) "stw" [1]=> string(3) "stw" } int(64) int(64) array(2) { [0]=> string(8) "stopword" [1]=> string(8) "stopword" } int(73) int(73)
Output for 4.3.2 - 4.3.3
string(14) "(stw|stopword)" Fatal error: Call to undefined function: mb_regex_encoding() in /in/8WbI7 on line 14
Process exited with code 255.
Output for 4.3.0 - 4.3.1
string(14) "(stw|stopword)" Fatal error: Call to undefined function: mb_regex_encoding() in /in/8WbI7 on line 14