我在该行有一个语法错误:return (double) + (double);
public function getMicroTime( )
{
list( $usec, $sec ) = explode( " ", microtime( ) );
return (double) + (double);
}
你能帮我解决这个问题吗?
我在该行有一个语法错误:return (double) + (double);
public function getMicroTime( )
{
list( $usec, $sec ) = explode( " ", microtime( ) );
return (double) + (double);
}
你能帮我解决这个问题吗?
The (double)
type cast behaves much like a unary operator and thus requires an argument next to it. You should return the following instead:
return (double)$usec + (double)$sec;
However, since 5.0, your whole function can be replaced by simply this:
microtime(true);
By passing true
as the first argument, it returns the time as a float with ms accuracy.
google finds this, based on your vars, you may be missing something in your copy and paste skills :-)
function getmicrotime($t) {
list($usec, $sec) = explode(" ",$t);
return ((float)$usec + (float)$sec);
}