<?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 );
You have javascript disabled. You will not be able to edit any code.