3v4l.org

run code in 300+ PHP versions simultaneously
<?php $filename = 'fgdsahktyrewagfbdhzbvt74tf.gfdhsgfghsdf.gsdfhjgfdsg.gsfdghfdsh.dtasfghsdghg.tar.gz'; $t1 = microtime(true); for ($i = 0; $i < 100000; ++$i) { $e1 = substr($filename, strrpos($filename, '.') + 1); } $t2 = microtime(true); for ($n = 0; $n < 100000; ++$n) { $e2 = pathinfo($filename, \PATHINFO_EXTENSION); } $t3 = microtime(true); for ($j = 0; $j < 100000; ++$j) { $e3 = substr(strrchr($filename, '.'), 1); } $t4 = microtime(true); echo '1: ' . ($t2-$t1), PHP_EOL; echo '2: ' . ($t3-$t2), PHP_EOL; echo '3: ' . ($t4-$t3), PHP_EOL;

preferences:
34.8 ms | 408 KiB | 5 Q