<?php $str = ''; for( $i = 0; $i <= 100; $i++ ) { $str .= str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'); } $start = microtime(true); for( $i = 0; $i<800000; $i++ ) { substr_count( 'foobar', $str ); } echo "count: " . (microtime(true)-$start) . PHP_EOL; $start = microtime(true); for( $i = 0; $i<800000; $i++ ) { preg_match_all( '/foobar/', $str ); } echo "rcount: " . (microtime(true)-$start) . PHP_EOL;
You have javascript disabled. You will not be able to edit any code.
This script was stopped while abusing our resources