3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myVar = "original"; testFunc([$myVar]); echo "Variable value: $myVar <br>"; // Output is: "Variable value: original" testFunc([&$myVar]); echo "Variable value: $myVar <br>"; // Output is: "Variable value: changed" testFunc([&$undefinedVar]); echo "Variable value: $undefinedVar<br>"; // Output is: "Variable value: changed" @testFunc([$undefinedVar_2]); echo @"Variable value: $undefinedVar_2<br>"; // Output is: "Variable value: " function testFunc( array $arr ) : void { ob_start(); var_dump($arr); if(preg_match('#&(int|NULL|string)#',ob_get_clean())){ print 'is ref '; var_dump($arr); } if ( !is_array($arr) || count($arr) == 0 ) return; $arr[0] = 'changed'; }
Output for git.master, git.master_jit, rfc.property-hooks
Variable value: original <br>is ref array(1) { [0]=> &string(8) "original" } Variable value: changed <br>is ref array(1) { [0]=> &NULL } Variable value: changed<br>Variable value: <br>

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