<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Printf on Tahir Hashmi</title><link>https://tahirhashmi.com/tags/printf/</link><description>Recent content in Printf on Tahir Hashmi</description><generator>Hugo</generator><language>en-GB</language><managingEditor>mail@tahirhashmi.com (Tahir Hashmi)</managingEditor><webMaster>mail@tahirhashmi.com (Tahir Hashmi)</webMaster><lastBuildDate>Mon, 29 Dec 2025 11:13:16 +0700</lastBuildDate><atom:link href="https://tahirhashmi.com/tags/printf/index.xml" rel="self" type="application/rss+xml"/><item><title>Simple PHP Timer</title><link>https://tahirhashmi.com/posts/2010/08/09/simple-php-timer/</link><pubDate>Mon, 09 Aug 2010 12:23:45 +0000</pubDate><author>mail@tahirhashmi.com (Tahir Hashmi)</author><guid>https://tahirhashmi.com/posts/2010/08/09/simple-php-timer/</guid><description>&lt;p&gt;I was just trying to profile an HTML page for performance bottle-necks. I’m trying to follow a top-down approach, wherein I start from the entry script, and find the block of code that takes the biggest chunk of time before digging deeper into that chunk.&lt;/p&gt;
&lt;p&gt;At this stage, it’s not feasible to drop in a full-blown profiling tool like xdebug because of the set-up overhead and amount of data it generates. So, I wrote a simple timing function that you can call at various points in your program to provide incremental and cumulative timing info in milliseconds. Just call this function anywhere in your code with a message and it’ll print that message to your PHP output, followed by millisecond timing information at that point. Here’s the function implementation:&lt;/p&gt;</description></item></channel></rss>