3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
function runAllSamples(){ sample1(); sample2(); sample3(); runAllUnitTests(); } function sample1(){ $pageWriter = new PageWriter(); $pageWriter->write(); } class PageWriter{ private $useRandom = false; function __construct($testMode = false){ $useRandom = !$testMode; } function write(){ echo '';?> <?php } } function runAllUnitTests(){ $pageWriter = new PageWriter(false); $success = compareWebPageHTML($pageWriter.write()); echo 'Unit test PageWriter (sample one): ' . $success ? 'success' : 'failed'; } runAllSamples(); ?>
based on THc43
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '}', expecting end of file in /in/tYXn7 on line 24
Process exited with code 255.
Output for 5.3.21 - 5.6.16
Parse error: syntax error, unexpected '}' in /in/tYXn7 on line 24
Process exited with code 255.