Php detects server running capabilities
// Detection Function Support
Function isfun ($ funName ){
Return (false! = Function_exists ($ funName ))? 'Supported ':' <font color = red> not supported </font> ';
}
// Integer computing capability test
Function test_int (){
$ TimeStart = gettimeofday ();
For ($ I = 0; I I <3000000; $ I ++ ){
$ T = 1 + 1;
}
$ TimeEnd = gettimeofday ();
$ Time = ($ timeEnd ["usec"]-$ timeStart ["usec"])/1000000 + $ timeEnd ["sec"]-$ timeStart ["sec"];
$ Time = round ($ time, 3). "seconds ";
Return $ time;
}
// Floating point computing capability test
Function test_float (){
// Obtain the circumference Rate
$ T = pi ();
$ TimeStart = gettimeofday ();
For ($ I = 0; I I <3000000; $ I ++ ){
// Square
Sqrt ($ t );
}
$ TimeEnd = gettimeofday ();
$ Time = ($ timeEnd ["usec"]-$ timeStart ["usec"])/1000000 + $ timeEnd ["sec"]-$ timeStart ["sec"];
$ Time = round ($ time, 3). "seconds ";
Return $ time;
}
// IO Capability Test
Function test_io (){
$ Fp = @ fopen (PHPSELF, "r ");
$ TimeStart = gettimeofday ();
For ($ I = 0; I I <10000; $ I ++ ){
@ Fread ($ fp, 10240 );
@ Rewind ($ fp );
}
$ TimeEnd = gettimeofday ();
@ Fclose ($ fp );
$ Time = ($ timeEnd ["usec"]-$ timeStart ["usec"])/1000000 + $ timeEnd ["sec"]-$ timeStart ["sec"];
$ Time = round ($ time, 3). "seconds ";
Return ($ time );
}