3v4l.org

run code in 300+ PHP versions simultaneously
<?php $filename = 'test/test/foo/bar/baz.php'; $start = microtime(true); for ($i = 0; $i < 1000000; $i++) { in_array(pathinfo( $filename, PATHINFO_EXTENSION ), ['php', 'phtml']); } echo 'in_array: ' . ( microtime(true) - $start ) . "\n"; $start = microtime(true); for ($i = 0; $i < 1000000; $i++) { preg_match('/\.(?:php|phtml)/i', $filename); } echo 'preg: ' . ( microtime(true) - $start );

preferences:
36.3 ms | 402 KiB | 5 Q