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 { function __construct() { echo 'second'; } } $b = get('check');
Output for 5.3.3 - 5.3.23, 5.4.0 - 5.4.13
Parse error: syntax error, unexpected '}', expecting '(' in /in/594m6 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 /in/594m6 on line 16 Parse error: syntax error, unexpected '}', expecting '(' in /in/594m6 on line 17
Process exited with code 255.

preferences:
166.42 ms | 1395 KiB | 45 Q