3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Person { public function foo() { echo 'Do foo job'; } } class Cabelo extends Person { public function foo() { echo 'Do Cabelo foo job'; } } $cabelo = new Cabelo; $result = $cabelo instanceof Person; echo 'instanceof result:'; var_dump($result) . PHP_EOL; $className = get_class($cabelo); $result2 = $className == 'Person'; echo 'get_classe result:'; var_dump($result2) . PHP_EOL;
based on Xf3HG
Output for 5.0.2 - 7.2.0
instanceof result:bool(true) get_classe result:bool(false)
Output for 5.0.0 - 5.0.1
instanceof result:bool(true) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/LIfua on line 24 get_classe result:bool(false) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/LIfua on line 31
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/LIfua on line 5
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/LIfua on line 5
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/LIfua on line 5
Process exited with code 255.