3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace MyProject; function get($classname) { $a = __NAMESPACE__ . '\\' . $classname; return new $a; } class check { function __construct() { echo 'first'; } function check } class check { } $b = get('check');
Output for 5.3.23, 5.4.13
Parse error: syntax error, unexpected '}', expecting '(' in /in/A4jHW on line 17
Process exited with code 255.
Output for 5.3.3 - 5.3.22, 5.4.0 - 5.4.12
Parse error: syntax error, unexpected '}', expecting '(' in drBnP on line 17
Process exited with code 255.
Output for 5.3.0 - 5.3.2
Strict Standards: Redefining already defined constructor for class MyProject\check in drBnP on line 16 Parse error: syntax error, unexpected '}', expecting '(' in drBnP on line 17
Process exited with code 255.

preferences:
173.02 ms | 1399 KiB | 45 Q