3v4l.org

run code in 300+ PHP versions simultaneously
<?php // $array is passed by reference function testForeach(&$array) { $array = array('a', 'b', 'c'); foreach ($array as $key => &$val) { //produces a, b as an output in PHP 5 //produces a, b, c as an output in PHP 7 var_dump($val); if ($val == 'b') { //remove 'c' from the array unset($array[2]); } } } $array = array(); testForeach($array);
Output for git.master, git.master_jit, rfc.property-hooks
string(1) "a" string(1) "b"

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:
121.71 ms | 405 KiB | 5 Q