PHP Classes

File: lib/time.php

Recommend this page to a friend!
  Classes of Muhammad Umer Farooq   PHP Convert and Time Difference   lib/time.php   Download  
File: lib/time.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Convert and Time Difference
Spell the time difference between now and one day
Author: By
Last change: Apply fixes from StyleCI
Date: 5 years ago
Size: 740 bytes
 

Contents

Class file image Download
<?php

/**
 * Create instence of class.
 *
 * @return object
 */
function time_object()
{
    return new
Time();
}
/**
 * Convert timespam to human readable form.
 *
 *
 * @return string
 */
function friendly_time($time)
{
    return
time_object()->TimeAgo($time);
}
/**
 * calculate execution time of script.
 *
 * @param $start starting time of script
 * end => ending time
 * round => optional
 *
 * @return string
 */
function execution_time($start, $end, $round)
{
    return
time_object()->ExecutionTime(['start'=>$start, 'end'=>$end, 'round'=>$round]);
}
/**
 * Calculate the age of users.
 *
 * @param (date) date of birth of user
 *
 * @return int
 */
function calculate_age($dob)
{
    return
time_object()->CalculateAge($dob);
}