Code
<?php $d1 = date('Y-m-d H:i:s').substr(microtime(), 1, 10); $m1 = time().substr(microtime(), 1, 10); $m2 = (double)(time().substr(microtime(), 1, 10)); $m3 = microtime(true); $s1 = date_create()->format("Y-m-d H:i:s.u"); $s2 = date_create()->format("s.u"); $s3 = date_create()->format("c.u"); $s4 = date_create()->format("U.u"); usleep(100); echo "\ndate1 : ". $d1; echo "\nmicrotime1 : ". $m1; echo "\nmicrotime2 : ". $m2; echo "\nmicrotime3 : ". $m3; echo "\ndate_create1 : ". $s1; echo "\ndate_create2 : ". $s2; echo "\ndate_create3 : ". $s3; echo "\ndate_create4 : ". $s4; echo "\n"; echo "\nnow - microtime2 : ". ((double)(time().substr(microtime(), 1, 10)) - $m2) ; echo "\nnow - microtime3 : ". ( microtime(true)- $m3) ; echo "\nnow - date_create2 : ". ( date_create()->format("s.u") - $s2) ; echo "\nnow - date_create4 : ". ( date_create()->format("U.u") - $s4) ; echo "\n";
Result
date1 : 2018-04-25 16:36:44.74041200 microtime1 : 1524643604.74042800 microtime2 : 1524643604.7404 microtime3 : 1524643604.7404 date_create1 : 2018-04-25 16:36:44.740468 date_create2 : 44.740489 date_create3 : 2018-04-25T16:36:44+08:30.740499 date_create4 : 1524643604.740509 now - microtime2 : 0.00031089782714844 now - microtime3 : 0.00030612945556641 now - date_create2 : 0.00028600000000267 now - date_create4 : 0.00029706954956055
'lang > php' 카테고리의 다른 글
PHP Performence On Framework And Event-driven PHP (1) (0) | 2018.06.01 |
---|---|
텍스트 치환 함수 속도 String Replacement Method Speed (0) | 2018.04.26 |
php log file write speed (0) | 2018.04.20 |
Ubuntu php7.1/7.2 Switch (0) | 2018.03.02 |
Yii model get query (0) | 2017.08.25 |