3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $count = 100; $start = microtime(true); for ($i = 0; $i < $count; $i++) { $str = "abc"; $str = preg_replace_callback('/a/', function($a) { return strtoupper($a[0]); }, $str); $str = preg_replace_callback('/b/', function($a) { return strtoupper($a[0]); }, $str); $str = preg_replace_callback('/c/', function($a) { return strtoupper($a[0]); }, $str); $str = preg_replace_callback('/a/', function($a) { return strtolower($a[0]); }, $str); $str = preg_replace_callback('/b/', function($a) { return strtolower($a[0]); }, $str); $str = preg_replace_callback('/c/', function($a) { return strtolower($a[0]); }, $str); } echo "Completed in " . (microtime(true) - $start) . " Seconds\n"; $start = microtime(true); for ($i = 0; $i < $count; $i++) { $str = "abc"; $str = preg_replace(array( '/a/e', '/b/e', '/c/e', '/a/e', '/b/e', '/c/e', ), array( 'strtoupper(\'$1\')', 'strtoupper(\'$1\')', 'strtoupper(\'$1\')', 'strtolower(\'$1\')', 'strtolower(\'$1\')', 'strtolower(\'$1\')', ), $str ); } echo "Completed in " . (microtime(true) - $start) . " Seconds\n";

Abusive script

This script was stopped while abusing our resources