3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $obj = new stdClass(); $obj->{123} = "foo"; $arr = (array)$obj; var_dump($arr); var_dump($arr['123'], $arr[123]);

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
array(1) { ["123"]=> string(3) "foo" } Notice: Undefined offset: 123 in /in/GPtRX on line 7 Notice: Undefined offset: 123 in /in/GPtRX on line 7 NULL NULL
Output for Arrow functions
array(1) { [123]=> string(3) "foo" } string(3) "foo" string(3) "foo"
Output for Object typehint
array(1) { ["123"]=> string(3) "foo" } Notice: Undefined offset: 123 in /in/GPtRX on line 7 Notice: Undefined offset: 123 in /in/GPtRX on line 7 NULL NULL
Output for Array change keys
array(1) { ["123"]=> string(3) "foo" } Notice: Undefined offset: 123 in /in/GPtRX on line 7 Notice: Undefined offset: 123 in /in/GPtRX on line 7 NULL NULL
Output for Lexical anon
array(1) { ["123"]=> string(3) "foo" } Notice: Undefined offset: 123 in /in/GPtRX on line 7 Notice: Undefined offset: 123 in /in/GPtRX on line 7 NULL NULL

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