3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Orig {}; class Override {}; $instance = new Orig; function test() { global $instance; $newInstance = new Override; $instance=$newInstance; check(); } function check() { global $instance; var_dump($instance); } test();

preferences:
44.65 ms | 404 KiB | 5 Q