1. Go to this page and download the library: Download bentools/flatten-iterator 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/ */
bentools / flatten-iterator example snippets
use BenTools\FlattenIterator\FlattenIterator;
',
'paris' => 'Paris',
],
new \ArrayIterator([
'berlin' => 'Berlin',
'bruxelles' => 'Bruxelles',
]),
(function () {
yield 'budapest' => 'Budapest';
yield 'prague' => 'Prague';
})(),
];
foreach (new FlattenIterator($cities) as $city) {
var_dump($city);
}
use function BenTools\FlattenIterator\flatten;
print_r(flatten($cities)->asArray());