|
|
|
|
|
<?
class c_Timer {
var $t_start = 0;
var $t_stop = 0;
var $t_elapsed = 0;
function start() { $this->t_start = microtime(); }
function stop() { $this->t_stop = microtime(); }
function elapsed() {
if ($this->t_elapsed) {
return $this->t_elapsed;
} else {
$start_u = substr($this->t_start,0,10);
$start_s = substr($this->t_start,11,10);
$stop_u = substr($this->t_stop,0,10);
$stop_s = substr($this->t_stop,11,10);
$start_total = doubleval($start_u) + $start_s;
$stop_total = doubleval($stop_u) + $stop_s;
$this->t_elapsed = $stop_total - $start_total;
return $this->t_elapsed;
}
}
};
/* Here's an example usage:
$timer = new c_Timer;
$timer->start();
echo "<hr>";
$timer->stop();
echo $timer->elapsed();
*/
?> |
|
| Credit Card Identification and Validation Class - The credit_card class provides methods for cleaning, validating and identifying the type of credit card numbers. Categories : PHP, PHP Classes, Credit Cards, Ecommerce, Algorithms | | | Object() = Custom __autoload + Singleton. "automagically" instantiates a class and always retuns the same instance of the same class. It's pretty useful when you want to have persistence in objects. Categories : PHP, PHP Classes, Algorithms | | | Password Creator: This PHP code exmaple shows how to use bitwise operations on a single variable and using it as a flagged variable. The class generates passwords of a given length using specified characters and the flags. Categories : PHP, PHP Classes, Algorithms, Security | | | This code generates an MD5 protected string, which can be used to hand off to other web pages, or even other sites. Categories : Algorithms, PHP, PHP Classes | | | A class to put get and post variables in hidden form
elements. Works on scalars, normal arrays, associative
arrays. Categories : Algorithms, Variables, Arrays, PHP, PHP Classes | | | Example of using the pcCalendar class, article 1468 on weberdev.com. Calendar example. Categories : PHP, Date Time, PHP Classes, Calendar | | | The GTV.class allows you to extract a value between any HTML tag or between any TEXT on a web page. Categories : PHP, PHP Classes, Regexps | | | Password reminder Categories : PHP, PHP Classes, Databases, MySQL, Mail | | | Snoopy - the PHP net client v0.1 Categories : PHP, PHP Classes | | | Bs_StopWatch is a class to measure time intervals in microseconds.
Categories : PHP, Date Time, PHP Classes | | | Form Elements Class Categories : PHP, PHP Classes, Form Processing | | | An updated OOP - Inheritance Categories : PHP, PHP Classes, Object Oriented | | | PHP Zip Utility Categories : PHP, PHP Classes, Compression | | | Function to convert Arabic numbers into Roman Numerals Categories : Algorithms, PHP, Date Time | | | 3dLib - a class for drawing in 3D space. Supported functions: Line, SetPixel, Polygon, FilledPolygon, etc. 3dChart() function has been added for one-call drawing of 3d charts. Support of mostly used 3d-transformations. Categories : Graphics, Math., PHP Classes, PHP, Charts and Graphs | |
| |
| |
|