3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testCode = '<?php class {CLASS}'; try { var_dump(token_get_all($testCode, TOKEN_PARSE)); } catch (Throwable $ex) { echo "INVALID CODE:\n\n$ex"; } // var_dump(eval($testCode));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.14
INVALID CODE: ParseError: syntax error, unexpected token "{", expecting identifier in :1 Stack trace: #0 /in/VFDrG(6): token_get_all('<?php class {CL...', 1) #1 {main}
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
INVALID CODE: ParseError: syntax error, unexpected '{', expecting identifier (T_STRING) in :1 Stack trace: #0 /in/VFDrG(6): token_get_all('<?php class {CL...', 1) #1 {main}
Output for 5.6.32
Notice: Use of undefined constant TOKEN_PARSE - assumed 'TOKEN_PARSE' in /in/VFDrG on line 6 Warning: token_get_all() expects exactly 1 parameter, 2 given in /in/VFDrG on line 6 NULL

preferences:
140.48 ms | 408 KiB | 5 Q