/* * php 页面执行时间统计类 * */ class runtime { var $StartTime = 0; var $StopTime = 0;
//获取微秒 function get_microtime() { list($usec, $sec) = explode(' ', microtime()); return ((float)$usec + (float)$sec); } //记录开始时间 function start() { $this->StartTime = $this->get_microtime(); } //记录结束时间 function stop() { $this->StopTime = $this->get_microtime(); } //计算所用时间&取整 function spent() { return round(($this->StopTime - $this->StartTime) * 1000, 1); } }
$runtime = new runtime();
//循环次数 $count = 10000; $str = " string"; $str_single = 'This is a'; $str_double = "This is a"; $str_single_var = 'This is a'.$str; $str_double_var = "This is a$str"; echo ' ';
echo '循环输出'.$count.'次,单引号用时:'.$sp_single.' 双引号用时: '.$sp_double.' 单引号(混合)用时:'.$sp_single_var.' 双引号(混合)用时:'.$sp_double_var;
?> |
经测试发现,不混合的情况下,单引号的优势并不明显,混合时单引号效率明显优于双引号。
以后用以下格式: echo '

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)