3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function foo() { echo "I am only called once.\n"; return array('a', 'b', 'c', 'd', 'e'); } public function count($arr) { echo "I am only called once.\n"; return count($arr); } } $test = new Test(); foreach ($test->foo() as $value) { echo $value . "\n"; } $arr = array(1,2,3,4,5); for($i=0; $i < $test->count($arr); ++$i) { echo $arr[$i] . "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
I am only called once. a b c d e I am only called once. 1 I am only called once. 2 I am only called once. 3 I am only called once. 4 I am only called once. 5 I am only called once.

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:
31.24 ms | 401 KiB | 8 Q