title: Find out when the PHP script started execution
body: <p>If you want to calculate the time particular PHP script has been running you do it as following:</p>
  
  <pre><code>//Remember beginning time of the script
  define("START_TIME", time());
  
  //Do some loop or whatever
     ...
  
  //At the end, calculate the difference of start and current time
  echo "This script has been running for ".(time() - START_TIME)."\n";
  </code></pre>
  
  <p>Well, this is all nice, but imagine you're making a class/library, that might be included later in the script and that needs to calculate the runtime too.  </p>
  
  <p>Is there a function in PHP that would give me the timestamp when the script was launched - or a function that would allow me to deduct that?<br>
  This is what I need:</p>
  
  <pre><code>class Blah {
      public getRuntime() {
          static $startTime = get_start_time_magic_function();
          return time() - $startTime;
      }
  }
  </code></pre>
  
  <p>My reason to require is, that I have a "infinite" loop in a class, that should automatically end when execution limit is going to take effect. If the script was killed by PHP, that would cause harm to processed data.</p>