str_replace'; for( $i = 0; $i < MAX; $i++ ) { str_replace( 'replace this', '', $string ); $time = getMicrotime() - $start; if( $i % EVERY == 0 ) echo $time.'
'; } $start = getMicrotime(); echo '

preg_replace

'; for( $i = 0; $i < MAX; $i++ ) { preg_replace( '#replace this#', '', $string ); $time = getMicrotime() - $start; if( $i % EVERY == 0 ) echo $time.'
'; } preg_match( '#^(\d+)\.(\d+)\.(\d+)#', phpversion(), $m ); $version = (int)$m[1]*10000 + (int)$m[2]*100 + (int)$m[3]; if( $version >= 50000 ) { $start = getMicrotime(); echo '

str_ireplace

'; for( $i = 0; $i < MAX; $i++ ) { str_ireplace( 'Replace this', '', $string ); $time = getMicrotime() - $start; if( $i % EVERY == 0 ) echo $time.'
'; } $start = getMicrotime(); echo '

preg_replace (case insensitive)

'; for( $i = 0; $i < MAX; $i++ ) { preg_replace( '#Replace this#i', '', $string ); $time = getMicrotime() - $start; if( $i % EVERY == 0 ) echo $time.'
'; } } function getMicrotime() { list( $usec, $sec ) = explode (' ', microtime() ); return ( (float) $sec + (float) $usec ); } ?>