3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface Foo {} function f(Foo $x) {} f( (Foo) );
based on gcej0
Output for 7.2.0
Warning: Use of undefined constant Foo - assumed 'Foo' (this will throw an Error in a future version of PHP) in /in/MsdU0 on line 7 Fatal error: Uncaught TypeError: Argument 1 passed to f() must implement interface Foo, string given, called in /in/MsdU0 on line 7 and defined in /in/MsdU0:5 Stack trace: #0 /in/MsdU0(7): f('Foo') #1 {main} thrown in /in/MsdU0 on line 5
Process exited with code 255.
Output for 7.0.0 - 7.1.10
Notice: Use of undefined constant Foo - assumed 'Foo' in /in/MsdU0 on line 7 Fatal error: Uncaught TypeError: Argument 1 passed to f() must implement interface Foo, string given, called in /in/MsdU0 on line 7 and defined in /in/MsdU0:5 Stack trace: #0 /in/MsdU0(7): f('Foo') #1 {main} thrown in /in/MsdU0 on line 5
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Notice: Use of undefined constant Foo - assumed 'Foo' in /in/MsdU0 on line 7 Catchable fatal error: Argument 1 passed to f() must implement interface Foo, string given, called in /in/MsdU0 on line 7 and defined in /in/MsdU0 on line 5
Process exited with code 255.