<?php $time = microtime(true); for ($i = 0; $i < 1000000; $i++) { parse_url('https://stackoverflow.com/questions/20248666/in-this-case-which-is-better-in-matching-regular-expression-or-parse-url', PHP_URL_SCHEME); } echo number_format(microtime(true) - $time, 10), "\n"; $time = microtime(true); for ($i = 0; $i < 1000000; $i++) { strpos('https://stackoverflow.com/questions/20248666/in-this-case-which-is-better-in-matching-regular-expression-or-parse-url', '://'); strpos('https://stackoverflow.com/questions/20248666/in-this-case-which-is-better-in-matching-regular-expression-or-parse-url', '?'); } echo number_format(microtime(true) - $time, 10);
You have javascript disabled. You will not be able to edit any code.