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.'
';
}
$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 );
}
?>