PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Arturs Sosins   Multi-format countdown   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example usage
Class: Multi-format countdown
Show time left until a moment in different formats
Author: By
Last change: credits changed
Date: 12 years ago
Size: 1,472 bytes
 

Contents

Class file image Download
<?php
/*************************************************************
 * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com
 * Fee free to distribute and modify code, but keep reference to its creator
 *
 * Multi format countdown class can convert time left from any combination of
 * time units as seconds, minutes, hours, days, weeks, months and years to
 * any other combinations of time units.
 *
 * For more information, examples and online documentation visit:
 * http://webcodingeasy.com/PHP-classes/Generate-countdown-in-any-format
**************************************************************/

include("countdown.php");

//2 years 2 months 1 week 5 days 20 hours 30 minutes 40 seconds
//from Sun, 10 Apr 2011 00:09:20 +0300
//provided value in seconds
$cd = new countdown(array("s"=>69539440), 1302383360);
echo
"<pre>";
//get in years, months, weeks, days, hours, minutes and seconds
print_r($cd->get());
echo
"</pre>";

//114 weeks 6 days 1230 minutes 40 seconds
//from now
//provided value in weeks, days, minutes, seconds
$cd = new countdown(array("w" => 114, "d" => 6, "i" => 1230, "s" => 40));
echo
"<pre>";
//get in seconds
print_r($cd->get(array("s")));
echo
"</pre>";

//80 seconds
//from now
//provided value in seconds
$cd = new countdown(array("s" => 80));
echo
"<pre>";
//get in minutes (returns only full minutes)
print_r($cd->get(array("i")));
echo
"</pre>";
?>