3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class SetterTester { public function __set($name, $value) { echo 'Setter is used', PHP_EOL, PHP_EOL; } } // echo "Test normal version", PHP_EOL; // $test = new SetterTester(); // $test->property = "Some value"; echo "Test array version", PHP_EOL; $test = new SetterTester(); $test->{property["index"]} = "Some value";
based on 5ndpD
Output for 7.2.0
Test array version Warning: Use of undefined constant property - assumed 'property' (this will throw an Error in a future version of PHP) in /in/7qOqt on line 17 Warning: Illegal string offset 'index' in /in/7qOqt on line 17 Setter is used
Output for 5.6.8 - 7.1.10
Test array version Notice: Use of undefined constant property - assumed 'property' in /in/7qOqt on line 17 Warning: Illegal string offset 'index' in /in/7qOqt on line 17 Setter is used
Output for 5.3.21 - 5.5.35
Parse error: syntax error, unexpected '[' in /in/7qOqt on line 17
Process exited with code 255.