3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Model { public static function test() { echo "it works\n"; } } class ModelName { public function getModelName() { return 'Model'; } } $modelName = new ModelName; $$modelName->getModelName()::test();
based on t7dpg
Output for 7.1.0 - 7.2.0
Recoverable fatal error: Object of class ModelName could not be converted to string in /in/SLAvB on line 14
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Catchable fatal error: Object of class ModelName could not be converted to string in /in/SLAvB on line 14
Process exited with code 255.
Output for 5.4.10 - 5.6.28
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM) in /in/SLAvB on line 14
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /in/SLAvB on line 14
Process exited with code 255.