3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Something extends \SplFileObject { public function __toString() { return 'calling __toString'; } } $file = sys_get_temp_dir() . 'foo.php'; touch($file); $something = new Something($file); echo $something; // 'calling __toString' echo (string) $something; // 'test.php' echo $something->__toString(); // 'calling __toString'

preferences:
50.67 ms | 402 KiB | 5 Q