3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $input = '((800 + 20) - 800 / 2)'; $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("<?php $result = {$expr};"); print "\nexpr = " . $expr; print "\nres = " . $result;
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: result in /in/bIslL on line 24 Parse error: syntax error, unexpected '<', expecting end of file in /in/bIslL(24) : eval()'d code on line 1
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: result in /in/bIslL on line 24 Fatal error: syntax error, unexpected '<', expecting $end in /in/bIslL(24)(2e96d30ec6a5a09572cf8b18e47ac413) : eval()'d code on line 1 expr = ((800+20)-800/2) Notice: Undefined variable: result in /in/bIslL on line 27 res =
Output for 5.4.11 - 5.6.28
Notice: Undefined variable: result in /in/bIslL on line 24 Parse error: syntax error, unexpected '<' in /in/bIslL(24) : eval()'d code on line 1 expr = ((800+20)-800/2) Notice: Undefined variable: result in /in/bIslL on line 27 res =
Output for 5.1.0 - 5.4.10
Notice: Undefined variable: result in /in/bIslL on line 24 Parse error: syntax error, unexpected '<' in /in/bIslL(24) : eval()'d code on line 1 expr = ((800+20)-800/2) Notice: Undefined variable: result in /in/bIslL on line 27 res =
Process exited with code 255.
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: result in /in/bIslL on line 24 Parse error: parse error, unexpected '<' in /in/bIslL(24) : eval()'d code on line 1 expr = ((800+20)-800/2) Notice: Undefined variable: result in /in/bIslL on line 27 res =
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.3
Notice: Undefined variable: result in /in/bIslL on line 24 Parse error: parse error, unexpected '<' in /in/bIslL(24) : eval()'d code on line 1 expr = ((800+20)-800/2) Notice: Undefined variable: result in /in/bIslL on line 27 res =
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Notice: Undefined variable: result in /in/bIslL on line 24 Parse error: syntax error, unexpected '<' in /in/bIslL(24) : eval()'d code on line 1 expr = ((800+20)-800/2) Notice: Undefined variable: result in /in/bIslL on line 27 res =
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Notice: Undefined variable: result in /in/bIslL on line 24 Parse error: parse error in /in/bIslL(24) : eval()'d code on line 1 expr = ((800+20)-800/2) Notice: Undefined variable: result in /in/bIslL on line 27 res =
Process exited with code 255.