3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __get( $property ) { if ( 'bla' === $property ) { echo 'Initializing Text->bla' . PHP_EOL; $this->bla = 'Value'; return $this->bla; } $message = sprintf( 'Undefined property: %s::$%s', get_class(), $property ); trigger_error( $message, E_USER_NOTICE); return null; } public function test_unset( $offset ) { unset ( $this->bla[ $offset ] ); } } $test = new Test(); echo $test->bla[2] . PHP_EOL; $test->test_unset( 2 ); echo $test->bla . PHP_EOL; echo $test->bla . PHP_EOL; echo $test->bla . PHP_EOL; echo $test->kaka . PHP_EOL; echo $test->bla . PHP_EOL;

preferences:
35.73 ms | 402 KiB | 5 Q