3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo preg_replace_callback('/(ä)|(ö)|(ü)|(Ä)|(Ö)|(Ü)|(ß)/', 'äöüÄÖÜß', function($matches){ foreach($matches as &$match){ switch($match){ case 'ü': $match = 'ue'; break; case 'ö': $match = 'oe'; break; case 'ä': $match = 'ae'; break; case 'Ü': $match = 'Ue'; break; case 'Ö': $match = 'Oe'; break; case 'Ä': $match = 'Ae'; break; case 'ß': $match = 'ss'; break; } } });
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught TypeError: preg_replace_callback(): Argument #2 ($callback) must be a valid callback, function "äöüÄÖÜß" not found or invalid function name in /in/jsCZq:3 Stack trace: #0 /in/jsCZq(3): preg_replace_callback('/(\xC3\xA4)|(\xC3\xB6)|(\xC3\xBC)...', '\xC3\xA4\xC3\xB6\xC3\xBC\xC3\x84\xC3\x96\xC3\x9C\xC3\x9F', Object(Closure)) #1 {main} thrown in /in/jsCZq on line 3
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught TypeError: preg_replace_callback(): Argument #2 ($callback) must be a valid callback, function "äöüÄÖÜß" not found or invalid function name in /in/jsCZq:3 Stack trace: #0 /in/jsCZq(3): preg_replace_callback('/(\xC3\xA4)|(\xC3\xB6)|(\xC3\xBC)...', '\xC3\xA4\xC3\xB6\xC3\xBC\xC3\x84\xC3\x96\xC3\x9C\xC3\x9F', Object(Closure)) #1 {main} thrown in /in/jsCZq on line 3
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Fatal error: Uncaught TypeError: preg_replace_callback(): Argument #2 ($callback) must be a valid callback, function "äöüÄÖÜß" not found or invalid function name in /in/jsCZq:29 Stack trace: #0 /in/jsCZq(29): preg_replace_callback('/(\xC3\xA4)|(\xC3\xB6)|(\xC3\xBC)...', '\xC3\xA4\xC3\xB6\xC3\xBC\xC3\x84\xC3\x96\xC3\x9C\xC3\x9F', Object(Closure)) #1 {main} thrown in /in/jsCZq on line 29
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: preg_replace_callback(): Requires argument 2, 'äöüÄÖÜß', to be a valid callback in /in/jsCZq on line 29 Fatal error: Uncaught Error: Object of class Closure could not be converted to string in /in/jsCZq:29 Stack trace: #0 /in/jsCZq(29): preg_replace_callback('/(\xC3\xA4)|(\xC3\xB6)|(\xC3\xBC)...', '\xC3\xA4\xC3\xB6\xC3\xBC\xC3\x84\xC3\x96\xC3\x9C\xC3\x9F', Object(Closure)) #1 {main} thrown in /in/jsCZq on line 29
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Warning: preg_replace_callback(): Requires argument 2, 'äöüÄÖÜß', to be a valid callback in /in/jsCZq on line 29 Recoverable fatal error: Object of class Closure could not be converted to string in /in/jsCZq on line 29
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20
Warning: preg_replace_callback(): Requires argument 2, 'äöüÄÖÜß', to be a valid callback in /in/jsCZq on line 29 Catchable fatal error: Object of class Closure could not be converted to string in /in/jsCZq on line 29
Process exited with code 255.

preferences:
187.61 ms | 402 KiB | 228 Q