3v4l.org

run code in 300+ PHP versions simultaneously
<?php mb_internal_encoding('SJIS-win'); $patern = 'abc'; $string1 = 'abcdeあいうえお'; $string2 = 'abcde'; $string3 = 'あabcdeⅰⅱⅲ'; $regs1 = array(); $regs2 = array(); $regs3 = array(); $replace = 'あいうえおⅰ'; mb_regex_encoding('SJIS-win'); print(mb_regex_encoding()); print("\n"); mb_ereg($patern, $string1, $regs1); mb_ereg($patern, $string2, $regs2); mb_ereg($patern, $string3, $regs3); var_dump($regs1); var_dump($regs2); var_dump($regs3); var_dump(mb_eregi_replace($patern, $replace, $string1)); var_dump(mb_eregi_replace($patern, $replace, $string2)); var_dump(mb_eregi_replace($patern, $replace, $string3));
Output for 7.1.0 - 7.1.30, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.26, 8.0.0 - 8.0.13, 8.1rc1 - rc3
SJIS array(0) { } array(1) { [0]=> string(3) "abc" } array(0) { } NULL string(20) "あいうえおⅰde" string(17) "あabcdeⅰⅱⅲ"
Output for 5.6.38 - 5.6.40, 7.0.33
SJIS array(1) { [0]=> string(3) "abc" } array(1) { [0]=> string(3) "abc" } array(0) { } string(35) "あいうえおⅰdeあいうえお" string(20) "あいうえおⅰde" string(17) "あabcdeⅰⅱⅲ"

preferences:
27.06 ms | 461 KiB | 5 Q