3v4l.org

run code in 300+ PHP versions simultaneously
<?php // r() simply returns a reference to a given variable. function &r(&$v){return $v;} // Here, we have a scalar $a on which settype() fails to operate if // parentheses are involved. print "Scalar demonstration:\n"; $a = 1; // First with parentheses, then without. // v v settype( ( r($a) ) , "boolean"); var_dump($a); settype( r($a) , "boolean"); var_dump($a); // ^ ^ // Here is a similar situation where array_pop() fails to operate upon a // reference to an array if parentheses are involved. print "\nArray demonstration:\n"; $b = array("c"); // First with parentheses, then without. // v v array_pop( ( r($b) ) ); print_r($b); array_pop( r($b) ); print_r($b); // ^ ^
Output for git.master, git.master_jit, rfc.property-hooks
Scalar demonstration: bool(true) bool(true) Array demonstration: Array ( ) Array ( )

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