PHP code example of sashabo / iterable-string
1. Go to this page and download the library: Download sashabo/iterable-string 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/ */
sashabo / iterable-string example snippets
foreach (new IterableString('lorem ipsum') as $position => $char) {
echo $position.'['.$char.'] ';
}
$iterableString = new IterableString('lorem ipsum');
while ($iterableString->valid()) {
echo $iterableString->key().'['.$iterableString->current().'] ';
$iterableString->next();
}
foreach (new MultibyteIterableString('visgaršīgākie āboli Rīgā') as $position => $char) {
echo $position.'['.$char.'] ';
}