3v4l.org

run code in 300+ PHP versions simultaneously
<?php $one = array( 1, 2, 3 ); $two = array( null ); $two[1] =& $one; var_dump( $two ); class foo { static function bar( &$v ) { var_dump( $v ); } } foo::bar( $two ); /* class foo { static $mem; static function setMem( &$v ) { self::$mem[ $v[0] ] = $v[1]; } static function readMem( &$v ) { $a = $v[3]; $v[2][$a] =& self::$mem[ $v[1] ]; } static function reset( &$v ) { reset( $v[0] ); } static function each( &$v ) { var_dump( $v ); $t = each( $v[0] ); self::$mem[ $v[1] ] = $t[1]; } static function show( &$v ) { echo $v[0]; } } $reset = array(null); $each = array(null, 'new'); $show = array(null); $arr = array( array('variable', array(1, 2, 3) ), array( 1=>'variable', 3=>0 ), array(), array( 1=>'variable', 3=>0 ), $each, array( 1=>'new', 3=>0 ),// 5 $show, ); $arr[1][2] =& $reset; $arr[2][0] =& $reset; $arr[3][2] =& $each; $arr[5][2] =& $show; $n = 0; foo::setMem( $arr[$n++] ); // 0 foo::readMem( $arr[$n++] ); // 1 foo::reset( $arr[$n++] ); // 2 foo::readMem( $arr[$n++] ); // 3 var_dump( $each ); foo::each( $arr[$n++] ); // 4 foo::readMem( $arr[$n++] ); // 5 foo::show( $arr[$n++] ); // 6 */
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> NULL [1]=> &array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } } array(2) { [0]=> NULL [1]=> &array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } }

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:
55.45 ms | 402 KiB | 8 Q