Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $original = 'prepend/youtube#video/postpend';
- $counter = 1000;
- $start = microtime(true);
- for ($walk = 0; $walk < $counter; $walk++) {
- $computed = preg_replace('/youtube#video/', '', $original);
- }
- $end = microtime(true);
- echo sprintf('preg_replace took %f', $end - $start) . PHP_EOL;
- $start = microtime(true);
- for ($walk = 0; $walk < $counter; $walk++) {
- $computed = str_replace('/youtube#video/', '', $original);
- }
- $end = microtime(true);
- echo sprintf('str_replace took %f', $end - $start) . PHP_EOL;
Add Comment
Please, Sign In to add comment