3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class foo { private $bar; public function __construct($bar) { $this->bar = $bar; } public function __toString() { return $bar; } } $a = new foo('abc'); $b = new foo('ab'); $pos = strpos($a,$b);
Output for 7.1.0 - 7.2.0
Notice: Undefined variable: bar in /in/tnoKs on line 9 Recoverable fatal error: Method foo::__toString() must return a string value in /in/tnoKs on line 15
Process exited with code 255.
Output for 5.3.21 - 7.0.20
Notice: Undefined variable: bar in /in/tnoKs on line 9 Catchable fatal error: Method foo::__toString() must return a string value in /in/tnoKs on line 15
Process exited with code 255.