3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dtArray = array(); $dtArray[] = new DateTime(); $dtArray[] = new DateTime(); foreach($dtArray as $value) { $value = null; } echo "object NOT reference: \n"; var_dump($dtArray); $dtArrayRef = array(); $dtArrayRef[] = new DateTime(); $dtArrayRef[] = new DateTime(); foreach($dtArrayRef as &$value) { $value = null; } echo "object REFERENCE: \n"; var_dump($dtArrayRef); $string = array(); $string[] = 'new DateTime();'; $string[] = 'new DateTime();'; foreach($string as $value) { $value = null; } echo "string NOT reference: \n"; var_dump($string);
Output for git.master
object NOT reference: array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-09 20:13:57.003940" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-09 20:13:57.003946" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } object REFERENCE: array(2) { [0]=> NULL [1]=> &NULL } string NOT reference: array(2) { [0]=> string(15) "new DateTime();" [1]=> string(15) "new DateTime();" }
Output for git.master_jit
object NOT reference: array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-09 20:13:57.004032" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-09 20:13:57.004038" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } object REFERENCE: array(2) { [0]=> NULL [1]=> &NULL } string NOT reference: array(2) { [0]=> string(15) "new DateTime();" [1]=> string(15) "new DateTime();" }
Output for rfc.property-hooks
object NOT reference: array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-09 20:13:57.003586" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-09 20:13:57.003588" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } object REFERENCE: array(2) { [0]=> NULL [1]=> &NULL } string NOT reference: array(2) { [0]=> string(15) "new DateTime();" [1]=> string(15) "new DateTime();" }

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