1. Go to this page and download the library: Download h4kuna/iterators 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/ */
h4kuna / iterators example snippets
$incomingString = " foo
bar
joe";
$textIterator = new TextIterator($incomingString);
$textIterator->setFlags($textIterator::SKIP_EMPTY_LINE | $textIterator::TRIM_LINE);
foreach($textIterator as $line) {
echo $line;
}
/*
* output will be trimed
foo
bar
joe
*/
use h4kuna\Iterators\PeriodDayFactory;
$endDate = new \DateTime('1996-04-09 08:00:00');
$period = PeriodDayFactory::createExFromInTo(new \DateTime('1989-02-01 07:00:00'), $endDate);
foreach ($period as $date) {
// first date is 1989-02-02
// last date is 1996-04-09
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.