3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function replaceExtension($subject, $search = ['.jpeg', '.jpg'], $replace = ['.png']) { return str_replace($search, $replace, $subject); } $tests = [ 'http://a3.mzstatic.com/us/r30/Purple4/v4/cc/74/5c/cc745cd5-9276-71ce-aaf2-0a4b380a2a1c/screen320x320.jpeg', 'http://is1.acf-7e2e-fe9b-4f2d-19019cbce528/mzl.vtyihyzd.png/0x0ss-85.jpg', 'https://itunes.apple.com/ru/developer/mail.ru-games/id566278107?ign-mpt=uo%3D4', 'https://itunes.apple.com/ru/developer/mail.ru-games/id566278107?ign-mpt=uo%3D4.png', ]; foreach ($tests as $test) { echo replaceExtension($test), PHP_EOL; }
based on HeSv3
Output for 5.4.1 - 7.2.0
http://a3.mzstatic.com/us/r30/Purple4/v4/cc/74/5c/cc745cd5-9276-71ce-aaf2-0a4b380a2a1c/screen320x320.png http://is1.acf-7e2e-fe9b-4f2d-19019cbce528/mzl.vtyihyzd.png/0x0ss-85 https://itunes.apple.com/ru/developer/mail.ru-games/id566278107?ign-mpt=uo%3D4 https://itunes.apple.com/ru/developer/mail.ru-games/id566278107?ign-mpt=uo%3D4.png
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/rXjpF on line 2
Process exited with code 255.