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;
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7
Parse error: syntax error, unexpected '$this' (T_VARIABLE), expecting '(' in /in/W2sba on line 21
Process exited with code 255.

preferences:
169.66 ms | 1395 KiB | 36 Q