3v4l.org

run code in 200+ php & hhvm versions
<?php class PropTypeTest { public int $int; public string $string; public array $arr; public callable $callable; public stdClass $std; public OtherThing $other; public $mixed; } $reflector = new ReflectionClass(PropTypeTest::class); foreach ($reflector->getProperties() as $name => $property) { if ($property->hasType()) { printf("type: %s $%s;\n", $property->getType(), $property->getName()); } else { printf("mixed: $%s;\n", $property->getName()); } }
based on RepdN

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
type: int $int; type: string $string; type: array $arr; type: callable $callable; type: stdClass $std; type: OtherThing $other; mixed: $mixed;
Output for Arrow functions
Parse error: syntax error, unexpected 'int' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/A6XZO on line 4
Process exited with code 255.
Output for Object typehint
Parse error: syntax error, unexpected 'int' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/A6XZO on line 4
Process exited with code 255.
Output for Array change keys
Parse error: syntax error, unexpected 'int' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/A6XZO on line 4
Process exited with code 255.
Output for Lexical anon
Parse error: syntax error, unexpected 'int' (T_STRING), expecting variable (T_VARIABLE) in /in/A6XZO on line 4
Process exited with code 255.

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