Skip to content

Instantly share code, notes, and snippets.

@thomaslorentsen
Last active November 7, 2016 15:15
Show Gist options
  • Save thomaslorentsen/33bb9181b206cd8b86b2c5897e5a79b3 to your computer and use it in GitHub Desktop.
Save thomaslorentsen/33bb9181b206cd8b86b2c5897e5a79b3 to your computer and use it in GitHub Desktop.
<?php
// @see http://php.net/manual/en/class.generator.php
// @see http://php.net/manual/en/class.generator.php
function getRange ($max = 10) {
for ($i = 1; $i < $max; $i++) {
yield $k => $i;
}
}
foreach (getRange(PHP_INT_MAX) as $range) {
echo "Dataset {$range} <br>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment