3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Source: https://bugs.php.net/bug.php?id=60475 class Primary { public function __toString() { $GLOBALS['anObject'] = $this; return 'toString output from Primary'; } } $Foo = new Primary; str_replace('', '', $Foo); var_dump($GLOBALS['anObject']); // expected to be object of class Primary, actually string

preferences:
40.81 ms | 402 KiB | 5 Q