3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function Gen() { var_dump($this); yield 1; yield 2; yield 3; return 11; } public static function SGen() { var_dump(get_called_class()); yield 4; yield 5; yield 6; return 22; } } $a = new A(); $g = $a->Gen(); foreach ($g as $num) { var_dump($num); } var_dump($g->getReturn()); $g2 = A::SGen(); foreach ($g2 as $num) { var_dump($num); } var_dump($g->getReturn());
Output for git.master, git.master_jit, rfc.property-hooks
object(A)#1 (0) { } int(1) int(2) int(3) int(11) string(1) "A" int(4) int(5) int(6) int(11)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
53.63 ms | 401 KiB | 8 Q