Problem w tym że pokazuje mi aktualne microtime(); - zobaczcie sami.
---
Jestem taki ciut lewy w PHP więc proszę, nie krytykujcie mnie bo się uczę.
---
<?php $czaszamawiania = $czaskoncowy - $czaspoczatkowy; ?>
<?php $czaszamawiania = $czaskoncowy - $czaspoczatkowy; ?>
<?php $start = getmicrotime(); $koniec = getmicrotime(); ?>
<?php class timer { private $tm; private $total; private $pause; //------------------------------------------------- function __construct($autoStart=false) { $this->tm=null; // null: nie wystartował //$this->total=0; if ($autoStart) $this->start(); } //------------------------------------------------- public function start($returnAsFloat=true) { if ($this->tm===null) $this->total=0; return $this->result($returnAsFloat); } //------------------------------------------------- public function stop($returnAsFloat=true) { if ($this->tm===null) return false; if ($this->tm > 0 ){ // jeśli mniejsze od zera, to pauza włączona } $this->tm = null; return $this->result($returnAsFloat); } //------------------------------------------------- public function restart($returnAsFloat=true) { $this->tm=null; return $this->start($returnAsFloat); } //------------------------------------------------- public function pause($returnAsFloat=true) { if ($this->tm===null) return false; if ($this->tm >0 ) { // jeśli < 0to pauza już włączona była } $this->tm=-1; // -1 oznacza pauzę return $this->result($returnAsFloat); } //------------------------------------------------- function result($returnAsFloat=true) { //if ($this->tm===null) return false; $t=$this->total; if ($this->tm>0) { // jeśli <0 to pauza } return $t; } } ?>