PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Ravi Kumar   PHP Next Working Day   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Next Working Day
Compute the next working day from today
Author: By
Last change: Fixed weekend for current date, changed text to response, Added holidays reasons
Date: 8 years ago
Size: 976 bytes
 

Contents

Class file image Download
<?php

include_once 'Response.php';

$o = new Response( null, 'Asia/Calcutta' );

$k = $o->next('2016-01-01 09:02:30');

$response = $k->response;
$reasons = $k->reasons;
$current = $k->current;
$next = $k->next;

echo
'Current Date : ', $current->format('F'), ' ' , $current->format('d'), ' ' , $current->format('l'), ' ' , $current->format('h'), ':' , $current->format('i'), ' ' , $current->format('A'), '<br>' ;
echo
'Response in : ', $response, '<br>' ;

echo
'Reasons for delay : ';
if (
$reasons ) {

    echo
'<ul>';
    foreach (
$reasons as $key => $value) {
       
        if (
is_array($value) ) {
            echo
'<li>';
            echo
$key . ' -> ' . implode(', ', $value);
            echo
'</li>';
        }
        else {
            echo
'<li>';
            echo
$key . ' -> ' . $value;
            echo
'</li>';
        }
    }
    echo
'</ul>';
}


echo
'Response Date : ', $next->format('F'), ' ' , $next->format('d'), ' ' , $next->format('l'), ' ' , $next->format('h'), ':' , $next->format('i'), ' ' , $next->format('A'), '<br>' ;