*/ /** * uses the PEAR::Benchmark_Timer class */ require_once 'Benchmark/Timer.php'; $string = 'RadioGroup_Option'; $timer = &new Benchmark_Timer(); $timer->start(); // strpos for( $i = 1; $i <= 5000; $i++ ) { if( strpos( $string, '_' ) !== false ) { } } $timer->setMarker( 'strpos' ); // strstr for( $i = 1; $i <= 5000; $i++ ) { if( strstr( $string, '_' ) !== false ) { } } $timer->setMarker( 'strstr' ); // stristr for( $i = 1; $i <= 5000; $i++ ) { if( stristr( $string, '_' ) !== false ) { } } $timer->setMarker( 'stristr' ); // str_replace for( $i = 1; $i <= 5000; $i++ ) { str_replace( '_', '/', $string ); } $timer->setMarker( 'str_replace' ); $timer->stop(); $timer->display(); ?>