Skip to content

Instantly share code, notes, and snippets.

@CodeMan99
Last active June 25, 2025 11:50
Show Gist options
  • Save CodeMan99/0c6ae060b2667af2d0fa967893c25c50 to your computer and use it in GitHub Desktop.
Save CodeMan99/0c6ae060b2667af2d0fa967893c25c50 to your computer and use it in GitHub Desktop.
Excel columns letters using LazyCollection
<?php
use Illuminate\Support\LazyCollection;
$columns = LazyCollection::make(function() {
yield $i = 1 => $c = 'A';
while (true) {
yield ++$i => $c = str_increment($c);
}
});
$columnIndexes = $columns->flip();
dump([...$columns->skip(51)->take(17)]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment