我想知道PHP for循环执行需要多少毫秒.
我知道通用算法的结构,但不知道如何在PHP中实现它:
Begin
init1 = timer(); // where timer() is the amount of milliseconds from midnight
the loop begin
some code
the loop end
total = timer() - init1;
End
Run Code Online (Sandbox Code Playgroud) 如果脚本以32位或64位运行,有没有人知道在PHP中检查的方法?目前我正在使用PHP 5.3.5.
理想情况下,我想编写一个函数,所以我的代码看起来像这样:
if( is_32bit() === true ) {
do_32bit_workaround();
}
do_everything_else();
Run Code Online (Sandbox Code Playgroud)
有人有什么想法?
我希望在我使用的JavaScript中获得PHP中的当前时间戳(以毫秒为单位) Date.now()
1436030635348
Run Code Online (Sandbox Code Playgroud)
我试过以下的东西:
$time = str_replace(".","",microtime(true));
Run Code Online (Sandbox Code Playgroud)
但有时它不能正常工作.就像它打印一个或两个数字少.
我有一个字幕文件,其中有 start_time 和 end_time ,其格式如下00:38:42,689但我不希望这样,我有以毫秒为单位的字幕功能,所以我想在 php 中以毫秒为单位转换它。
我怎样才能完成它。谢谢