3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface IFace{ function doSomething(); } class Foo implements IFace { function doSomething() { return 'OK'; } } class Bar { $face = null; function __construct(IFace $f) { $this->face = $f; } } $bar = new Bar(new Foo());
Output for 5.4.0 - 5.4.19
Parse error: syntax error, unexpected '$face' (T_VARIABLE), expecting function (T_FUNCTION) in /in/L5VfF on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /in/L5VfF on line 14
Process exited with code 255.

preferences:
183.44 ms | 1395 KiB | 55 Q