---
title: "计算php程序的执行时间"
author: "linlin_xiao"
date: "2015-10-18T17:58:31Z"
tags: []
categories: ["编程语言"]
slug: "php"
draft: false
lastmod: "2015-10-18T17:58:31Z"
id: 2249910
url: "https://xiaolinlin0326.iteye.com/blog/2249910"
---

需要以下三步：

 

&lt;?php   
$stime=microtime(true); //获取程序开始执行的时间   
echo "hello world";         //你执行的代码   
$etime=microtime(true);//获取程序执行结束的时间$total=$etime-$stime;   //计算差值   
echo "&lt;br /&gt;{$total} times";   
?&gt;