3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() {echo "THIS SHOULD NOT BE SEEN!!\n";} function ryat($a) {var_dump($a);} $str = "', test(), '"; echo "mb_ereg_replace()\n"; var_dump(mb_ereg_replace('^(.*)$', "ryat('\\1')", $str, 'e')); echo "\npreg_replace()\n"; var_dump(preg_replace('/^(.*)$/e', "ryat('\\1')", $str));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
mb_ereg_replace() Fatal error: Uncaught ValueError: Option "e" is not supported in /in/rcXvG:9 Stack trace: #0 /in/rcXvG(9): mb_ereg_replace('^(.*)$', 'ryat('\\1')', '', test(), '', 'e') #1 {main} thrown in /in/rcXvG on line 9
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
mb_ereg_replace() Deprecated: mb_ereg_replace(): The 'e' option is deprecated, use mb_ereg_replace_callback instead in /in/rcXvG on line 9 THIS SHOULD NOT BE SEEN!! string(0) "" string(0) "" preg_replace() Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /in/rcXvG on line 12 NULL
Output for 7.0.0 - 7.0.33, 7.3.32 - 7.3.33
mb_ereg_replace() THIS SHOULD NOT BE SEEN!! string(0) "" string(0) "" preg_replace() Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /in/rcXvG on line 12 NULL
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
mb_ereg_replace() THIS SHOULD NOT BE SEEN!! string(0) "" string(0) "" preg_replace() Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /in/rcXvG on line 12 string(12) "', test(), '" string(0) ""
Output for 4.3.4 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45
mb_ereg_replace() THIS SHOULD NOT BE SEEN!! string(0) "" string(0) "" preg_replace() string(12) "', test(), '" string(0) ""
Output for 4.3.2 - 4.3.3
mb_ereg_replace() Fatal error: Call to undefined function: mb_ereg_replace() in /in/rcXvG on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
mb_ereg_replace() Fatal error: Call to undefined function: mb_ereg_replace() in /in/rcXvG on line 9

preferences:
325.17 ms | 401 KiB | 459 Q