PHP code example of vajiral / php-nzholidays

1. Go to this page and download the library: Download vajiral/php-nzholidays library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vajiral / php-nzholidays example snippets




use BigV\Holiday;
use BigV\NZHolidays;

19; $year <= 2021; $year++) {
    echo "$year --------------------------------------------------------------\n";
    foreach ($holidays as $holiday) {
        /* @var $holiday Holiday */
        echo date(DATE_RFC822, $holiday->occurrence($year)) . ' ' . $holiday->title . "\n";
    }
}

echo "-------------------------------------------------------------------\n";

$today = time();
echo date(DATE_RFC822, $today).($holidays->isWorkday($today) ? ' Today is a working day' : ' Today is not a working day')."\n";

$xmas = mktime (0, 0, 0, 12, 25, 2019);
echo date(DATE_RFC822, $xmas).($holidays->isWorkday($xmas) ? ' Xmas is a working day' : ' Xmas is not a working day')."\n";

$saturday = mktime (0, 0, 0, 6, 1, 2019);
echo date(DATE_RFC822, $saturday).($holidays->isWorkday($saturday) ? ' Jun 1 is a working day' : ' Jun 1 is not a working day')."\n";

$today = time();
$target = $holidays->workHoursHence($today, 48);
echo "48 work hours from " . date(DATE_RFC822, $today) . " is " . date(DATE_RFC822, $target) . "\n";
"composer