PHP code execution time

后端 未结 9 952
既然无缘
既然无缘 2021-02-14 14:13

How to find my code execution time?

I am using the below snippet.

I am not happy with that?

list ($msec, $sec) = explode(\' \', microtime());
$mi         


        
9条回答
  •  温柔的废话
    2021-02-14 14:40

    In LINUX:

    For one simple code:

    time php -r "echo 'hello';"

    output:

    hello
    real 0m0.095s
    user 0m0.033s
    sys 0m0.055s

    For a php file:

    time php hello.php

    output:

    hello
    real 0m0.073s
    user 0m0.025s
    sys 0m0.047s

提交回复
热议问题