3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path1 = 'C:\Winwdows\system32\drivers\etc'; $path2 = '/foo/bar/sub/home'; $startTime = microtime(true); for ($i = 0; $i < 1000000, $i++;) { strtr($path1, '\\', '/'); strtr($path2, '\\', '/'); } echo number_format(( (microtime(true) - $startTime) * 1000), 4) . " ms (strtr)\n"; $startTime = microtime(true); for ($i = 0; $i < 1000000, $i++;) { str_replace('\\', '/', $path1); str_replace('\\', '/', $path2); } echo number_format(( (microtime(true) - $startTime) * 1000), 4) . " ms (str_replace) \n";

preferences:
40.64 ms | 402 KiB | 5 Q