3v4l.org

run code in 300+ PHP versions simultaneously
<?php function prop($name = null, $unset = false) { static $data = array(); if(empty($name)) return $data; if(!empty($unset) && isset($data[$name])){ unset($data[$name]); return; } if(!isset($data[$name])){ $data[$name] = new stdClass(); } return $data[$name]; } echo "---------------------------\n"; prop('user')->name = 'Alex'; prop('user')->age = 26; prop('item')->value = 'dfg'; prop('item')->total = 2; print_r(prop()); prop('item', 'unset'); print_r(prop()); ?>
Output for git.master, git.master_jit, rfc.property-hooks
--------------------------- Array ( [user] => stdClass Object ( [name] => Alex [age] => 26 ) [item] => stdClass Object ( [value] => dfg [total] => 2 ) ) Array ( [user] => stdClass Object ( [name] => Alex [age] => 26 ) )

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