I've tested thecode and there is what i've got
Proceduraltook 1.24408602715 seconds
OOtook 1.24240803719 seconds
Here is the code. Test it by yourself
<?php    function getmicrotime(){        list($usec, $sec) = explode("
",microtime());        return ((float)$usec + (float)$sec);    }    function
icount($vs) {        $var=0;        while($count < $vs) {
$count++;        }    }    $time_start = getmicrotime();    icount(1000000);
echo "Procedural<br> took ". (getmicrotime() - $time_start) ." seconds<br>";
class count {        function icount($vs) {            $var=0;
while($count < $vs) {                $count++;            }        }    }
$time_start = getmicrotime();    $icount = new count;
$icount->icount(1000000);    echo "<br>OO<br> took ". (getmicrotime() -
$time_start) ." seconds";?>

> OO is slower then procedural.  You can test that out yourself or look at
> this article where the guy did a very basic test.  Maybe they will fix the
> speed problem by the time php5 comes around.
> http://www.phpbeginner.com/columns/demitrious/objects/8



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to