PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of meivin123   PHP Store Openings   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Basic usage example
Class: PHP Store Openings
Determine if a store is open at a given time
Author: By
Last change: fixed a small error
Date: 9 years ago
Size: 549 bytes
 

Contents

Class file image Download
<?php
require_once( "classes/Openings.php");
require_once(
"classes/DateUtils.php");
$open = array(
   
"Mon-Fri" => array("08:30-12:30","14:00-19:00"),
   
"Sat" => array("08:30-20:00"),
   
"Sun" => array("false")
    );
   
$exceptions = array(
   
"24.12.2014-31.12.2014" => array("false")
    );

$openings = new Openings($open, $exceptions);
$single = array("22.09.2014"=>array("08:30-12:30","14:00-20:00"));
$openings->addException($single);
if(
$openings->isOpen()){
    echo
"open";
}
else{
    echo
"closed";
}
?>