3v4l.org

run code in 300+ PHP versions simultaneously
<?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.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
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 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
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.1.6, 5.2.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.3.11, 4.4.0 - 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.

preferences:
230.34 ms | 401 KiB | 325 Q