Created
February 11, 2016 16:27
-
-
Save anonymous/2611cbe9564fd820b9b2 to your computer and use it in GitHub Desktop.
Differing results between php and hhvm.
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 | |
use Rx\Observable; | |
use Rx\Operator; | |
require_once "vendor/autoload.php"; | |
function rangeGenerator($start, $end) | |
{ | |
for ($i = $start; $i <= $end; $i++) { | |
yield $i; | |
} | |
} | |
$source = Observable::fromIterator(rangeGenerator(0, 12)); | |
$stream = $source | |
->subscribe(new \Rx\Observer\CallbackObserver( | |
function ($x) { | |
echo var_dump($x); | |
} | |
)) | |
; | |
foreach (rangeGenerator(0, 12) as $x) { | |
var_dump($x); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment