Created
May 17, 2017 02:18
-
-
Save copperwall/359499e227d1481e079565935b746fb8 to your computer and use it in GitHub Desktop.
Super Simple Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function simpleGenerator() { | |
yield 1; | |
yield 2; | |
} | |
foreach(simpleGenerator() as $val) { | |
echo "$val\n"; | |
} | |
// 1 | |
// 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment