3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A{ public $a = "Hello"; public function __toString(){ return $this-a; } } $a = new A; echo $a;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Undefined constant "a" in /in/Riint:6 Stack trace: #0 /in/Riint(11): A->__toString() #1 {main} thrown in /in/Riint on line 6
Process exited with code 255.
Output for 7.4.0 - 7.4.33
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 number in /in/Riint on line 6 Warning: A non-numeric value encountered in /in/Riint on line 6 Fatal error: Uncaught Error: Method A::__toString() must return a string value in /in/Riint:11 Stack trace: #0 {main} thrown in /in/Riint on line 11
Process exited with code 255.
Output for 7.3.32 - 7.3.33
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 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.3.0 - 7.3.31
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 number 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.2.0 - 7.2.33
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.33
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.4.1 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 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.

preferences:
227.31 ms | 402 KiB | 270 Q