3v4l.org

run code in 200+ php & hhvm versions
<?php class B { public function __toString() { return "Instances of B() can be treated as a strings!\n"; } } $b = new B(); print($b); //Instances of B() can be treated as a strings! print(is_string($b) ? 'true' : 'false'); //false
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.28 - 7.3.1
Instances of B() can be treated as a strings! false