php4.4.2
----------------------
2.4397580623627
2.4931750297546
2.4437429904938
2.4653182029724
2.4746921062469php5.0.5
-----------------------
3.0424320697784
3.0950748920441
3.0866429805756
3.1070549488068
3.0920219421387php5.1.2
-----------------------
2.2561061382294
2.2885680198669
2.2754049301147
2.2681200504303
2.2571129798889
----------------------
2.4397580623627
2.4931750297546
2.4437429904938
2.4653182029724
2.4746921062469php5.0.5
-----------------------
3.0424320697784
3.0950748920441
3.0866429805756
3.1070549488068
3.0920219421387php5.1.2
-----------------------
2.2561061382294
2.2885680198669
2.2754049301147
2.2681200504303
2.2571129798889
<?php
function microtime_float(){
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
class test {
var $string;
function example(){
$len=strlen($this->string);
$t=0;
for($i=0;$i<$len;$i++) {
$t=$t+ord($this->string[$i]);
}
}
}$time_start = microtime_float();
//由于函数较为复杂了些,因此我们将循环次数改为100000次。
for($i=1;$i<=100000;$i++) {
$testclass=new test();
$testclass->string='Hello World!';
$testclass->example();
}
$end_start = microtime_float();
echo $end_start-$time_start;
?>
----------------------
2.1476550102234
2.1667129993439
2.149875164032php5.0.5
-----------------------
2.8307240009308
2.8333261013031
2.835865020752php5.1.2
-----------------------
1.9845490455627
1.9616510868073
1.9744999408722
我看到这篇文章我了测试了一下
我的环境是celeron D 331+256M xp
apache2.0.55
httpd.conf
LoadModule php4_module "c:/php/sapi/php4apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
把php4.4.1 5.0.5 5.1.2
解压到c:根目录
测试时候改相应的名和拷贝相应的文件到windows和system32目录就可以了
有要求计算能力这么强的商业应用全都用JSP了。
但对于整体来说,php4的速度也不见得慢啊
毕竟,全站都是类,也是少见地