title: How to make Stopwatch in php
body: <p>I created a method in php like this:`</p>
  <pre><code>function start(){
      echo&quot;Stopwatch has started.&lt;br/&gt;&quot;;
      $this-&gt;startTime = mktime(date(&quot;H&quot;), date(&quot;s&quot;), date(&quot;m&quot;), date(&quot;d&quot;), date(&quot;Y&quot;));
      $_SESSION[&quot;time&quot;] = $this-&gt;starTime;
  }
  
  function stop(){
      echo&quot;stopwatch stopped. &lt;br/&gt;&quot;;
      $this-&gt;endTime = mktime(date(&quot;H&quot;)-1, date(&quot;s&quot;), date(&quot;m&quot;), date(&quot;d&quot;), date(&quot;Y&quot;));
      echo&quot;&lt;b&gt;Time Elapsed: &lt;/b&gt;, date('H:i:s', $this-&gt;endTime-$_SESSION['time'])&quot;; 
  }
  </code></pre>
  <p>}
  `</p>
  <p>my goal is to ask the stopwatch about the duration between start and stop. I have to show the duration, then I could use the stop watch multiple times, where the duration value each time I make it stop and start should be calculated properly. Can someone help me?</p>