On Wed, Jun 4, 2008 at 11:12 AM, Robert Cummings <[EMAIL PROTECTED]>
wrote:

> Did you just try to use a test that used a single iteration to prove me
> wrong? OMFG ponies!!! Loop each one of those 10 million times, use a
> separate script for each, and use the system time program to
> appropriately measure the time the system takes.


<?php

$str = 'asSAFAASFDADSfasfjhalskfjhlaseAERQWERQWER;.dafasjhflasfjd';
$search = 'fdasASDFAafdas';

$start = microtime();

for($i = 0; $i < 10000000; $i++)
    strpos($str, $search);

$end = microtime();
$r1 = $end - $start;

$start = microtime();

for($i = 0; $i < 10000000; $i++)
    stripos($str, $search);

$end2 = microtime();
$r2 = $end2 - $start;

echo "strpos: $r1\n";
echo "stripos: $r2\n";

if($r2 < $r1) {
    echo 'stripos is faster' . PHP_EOL;
}
------------------------------
strpos: 0.730519
stripos: -0.098887
stripos is faster

stripos still dominates ;)  what is this system time program you speak of ?
and, ill put them into separate programs when i get home this evening, and
have more time to screw around.

-nathan

Reply via email to