PHP: Load Time Script

PHP: Load Time

Load Time

This one is a must for developers and system admins. You need to know how long your site takes to load. Nobody sticks around waiting for a site to load anymore – there’s way too much content out there for that. Use this script to find out if your site is taking too long, and if it is, fix it. (more…)

PHP: Getting the difference between two time strings

To get the difference between two time strings use this code


function timeDiff($firstTime,$lastTime)

// convert to unix timestamps

// perform subtraction to get the difference (in seconds) between times

// return the difference
return $timeDiff;

//Usage :
echo timeDiff("2002-04-16 10:00:00","2002-03-16 18:56:32");


PHP: How to Get the Current Page URL

If you want to get the current page URL, you can use the following code:

function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER&#91;"HTTPS"&#93; == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER&#91;"SERVER_PORT"&#93; != "80") {
  $pageURL .= $_SERVER&#91;"SERVER_NAME"&#93;.":".$_SERVER&#91;"SERVER_PORT"&#93;.$_SERVER&#91;"REQUEST_URI"&#93;;
 } else {
  $pageURL .= $_SERVER&#91;"SERVER_NAME"&#93;.$_SERVER&#91;"REQUEST_URI"&#93;;
 return $pageURL;
  echo curPageURL();

Pin It on Pinterest