| 
<?php
use lib\StatesInfo\StatesInfo;
 
 require_once 'lib/StatesInfo/StatesInfo.php';
 
 $oSI = new StatesInfo('DE');
 
 $aStates = $oSI->listStates();
 echo '<h1>Liste der Bundesländer mit Feiertagen 2020</h1>' . PHP_EOL;
 echo '<ul>' . PHP_EOL;
 foreach ($aStates as $strShort => $strState) {
 echo '<li>' . $strState . ' (' . $strShort .  ')</li>' . PHP_EOL;
 $aList = $oSI->listOfficialHolidays($strShort, 2020);
 echo '<ul>' . PHP_EOL;
 foreach ($aList as $id => $aHoliday) {
 echo '<li>' . date('d.m.Y', $aHoliday['date']) . ': ' . $aHoliday['name'];
 if ($aHoliday['partial']) {
 echo ' <small> - nicht im gesamten Bundesland!</small> ';
 if ($strShort == 'BY') {
 echo '<b>';
 if (!$oSI->checkHolidayByPostcode($id, 86152)) {
 // Augsburg
 echo 'KEIN ';
 }
 echo 'Feiertag in Augsburg, ';
 if (!$oSI->checkHolidayByPostcode($id, 91154)) {
 // Roth
 echo 'KEIN ';
 }
 echo 'Feiertag in Roth</b>';
 }
 }
 echo '</li>' . PHP_EOL;
 }
 echo '</ul>' . PHP_EOL;
 }
 echo '</ul>' . PHP_EOL;
 
 // sometimes you need to query records according to an given state like
 // SELECT * FROM adress WHERE <condition>
 // but either there is no field for the state or the field has been insufficiently
 // or incompletely maintained ...
 echo '<h1>WHERE - condition für HH</h1>' . PHP_EOL;
 echo $oSI->getWhereCondition('HH', 'postcode') . PHP_EOL;
 
 
 echo '<h1>Bundesland für Postleitzahl 72145</h1>' . PHP_EOL;
 echo $oSI->getStateFromPostcode(72145) . PHP_EOL;
 
 echo '<h1>Feiertage 2021 in Sachsen</h1>' . PHP_EOL;
 $aList = $oSI->listOfficialHolidays('SN', 2021);
 foreach ($aList as $aHoliday) {
 echo date('d.m.Y', $aHoliday['date']) . ': ' . $aHoliday['name'] . '<br/>' . PHP_EOL;
 }
 
 |