3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A{ public $a = "Hello"; public function __toString(){ return $this-a; } } $a = new A; echo $a;
Output for 7.2.0
Warning: Use of undefined constant a - assumed 'a' (this will throw an Error in a future version of PHP) in /in/Riint on line 6 Notice: Object of class A could not be converted to int in /in/Riint on line 6 Warning: A non-numeric value encountered in /in/Riint on line 6 Recoverable fatal error: Method A::__toString() must return a string value in /in/Riint on line 11
Process exited with code 255.
Output for 7.1.0 - 7.1.10
Notice: Use of undefined constant a - assumed 'a' in /in/Riint on line 6 Notice: Object of class A could not be converted to int in /in/Riint on line 6 Warning: A non-numeric value encountered in /in/Riint on line 6 Recoverable fatal error: Method A::__toString() must return a string value in /in/Riint on line 11
Process exited with code 255.
Output for 5.3.18 - 7.0.20
Notice: Use of undefined constant a - assumed 'a' in /in/Riint on line 6 Notice: Object of class A could not be converted to int in /in/Riint on line 6 Catchable fatal error: Method A::__toString() must return a string value in /in/Riint on line 11
Process exited with code 255.