3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /** Object responsible for echoing debug data **/ class EchoLogger { public function addDebug($data) { echo $data; } } /** Object responsible for emailing debug data **/ class EmailLogger { public function addDebug($data) { /** Mail your data **/ } } class HttpClientService implements \SplSubject { private $observers = array(); public function getServiceStatus() { // -- SNIP -- $rand = rand(0, 10); $status = ($rand >= 5) ? 'success' : 'error'; // -- Snip -- return $status; } }
Output for 7.0.0 - 7.1.0
Fatal error: Class HttpClientService contains 3 abstract methods and must therefore be declared abstract or implement the remaining methods (SplSubject::attach, SplSubject::detach, SplSubject::notify) in /in/6U0oF on line 15
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Fatal error: Class HttpClientService contains abstract method (attach) and must therefore be declared abstract or implement the remaining methods in /in/6U0oF on line 15
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Fatal error: Class HttpClientService contains 3 abstract methods and must therefore be declared abstract or implement the remaining methods (SplSubject::attach, SplSubject::detach, SplSubject::notify) in /in/6U0oF on line 28
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/6U0oF on line 15 Fatal error: Class HttpClientService contains 3 abstract methods and must therefore be declared abstract or implement the remaining methods (SplSubject::attach, SplSubject::detach, SplSubject::notify) in /in/6U0oF on line 28
Process exited with code 255.
Output for 5.0.5
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/6U0oF on line 15 Fatal error: Interface 'SplSubject' not found in /in/6U0oF on line 15
Process exited with code 255.
Output for 5.0.0 - 5.0.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/6U0oF on line 15 Fatal error: Class 'SplSubject' not found in /in/6U0oF on line 15
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/6U0oF on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/6U0oF on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/6U0oF on line 6
Process exited with code 255.