3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $input = '((rats + stoats) - 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; print "\n symbol: " . $expr; } continue; } list($id, $text) = $token; if(in_array($id, array(T_DNUMBER, T_LNUMBER))){ $expr .= $text; print "\n number: " . $expr; } } eval("\$result = {$expr};"); print "\nexpr = " . $expr; print "\nres = " . $result;
Output for 7.0.0 - 7.1.0
symbol: ( symbol: (( symbol: ((+ symbol: ((+) symbol: ((+)- number: ((+)-800 symbol: ((+)-800/ number: ((+)-800/2 symbol: ((+)-800/2) Parse error: syntax error, unexpected ')' in /in/Edcsv(28) : eval()'d code on line 1
Process exited with code 255.
Output for hhvm-3.12.0
symbol: ( symbol: (( symbol: ((+ symbol: ((+) symbol: ((+)- number: ((+)-800 symbol: ((+)-800/ number: ((+)-800/2 symbol: ((+)-800/2) Fatal error: syntax error, unexpected ')' in /in/Edcsv(28)(66bfff07f34070403d60d3f246d8ca00) : eval()'d code on line 1 expr = ((+)-800/2) Notice: Undefined variable: result in /in/Edcsv on line 31 res =
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.4.11 - 5.6.28
symbol: ( symbol: (( symbol: ((+ symbol: ((+) symbol: ((+)- number: ((+)-800 symbol: ((+)-800/ number: ((+)-800/2 symbol: ((+)-800/2) Parse error: syntax error, unexpected ')' in /in/Edcsv(28) : eval()'d code on line 1 expr = ((+)-800/2) Notice: Undefined variable: result in /in/Edcsv on line 31 res =
Output for 5.1.0 - 5.4.10
symbol: ( symbol: (( symbol: ((+ symbol: ((+) symbol: ((+)- number: ((+)-800 symbol: ((+)-800/ number: ((+)-800/2 symbol: ((+)-800/2) Parse error: syntax error, unexpected ')' in /in/Edcsv(28) : eval()'d code on line 1 expr = ((+)-800/2) Notice: Undefined variable: result in /in/Edcsv on line 31 res =
Process exited with code 255.
Output for 5.0.4 - 5.0.5
symbol: ( symbol: (( symbol: ((+ symbol: ((+) symbol: ((+)- number: ((+)-800 symbol: ((+)-800/ number: ((+)-800/2 symbol: ((+)-800/2) Parse error: parse error, unexpected ')' in /in/Edcsv(28) : eval()'d code on line 1 expr = ((+)-800/2) Notice: Undefined variable: result in /in/Edcsv on line 31 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
symbol: ( symbol: (( symbol: ((+ symbol: ((+) symbol: ((+)- number: ((+)-800 symbol: ((+)-800/ number: ((+)-800/2 symbol: ((+)-800/2) Parse error: parse error, unexpected ')' in /in/Edcsv(28) : eval()'d code on line 1 expr = ((+)-800/2) Notice: Undefined variable: result in /in/Edcsv on line 31 res =
Process exited with code 255.
Output for 4.4.2 - 4.4.9
symbol: ( symbol: (( symbol: ((+ symbol: ((+) symbol: ((+)- number: ((+)-800 symbol: ((+)-800/ number: ((+)-800/2 symbol: ((+)-800/2) Parse error: syntax error, unexpected ')' in /in/Edcsv(28) : eval()'d code on line 1 expr = ((+)-800/2) Notice: Undefined variable: result in /in/Edcsv on line 31 res =
Process exited with code 255.
Output for 4.3.2 - 4.3.4
symbol: ( symbol: (( symbol: ((+ symbol: ((+) symbol: ((+)- number: ((+)-800 symbol: ((+)-800/ number: ((+)-800/2 symbol: ((+)-800/2) Parse error: parse error in /in/Edcsv(28) : eval()'d code on line 1 expr = ((+)-800/2) Notice: Undefined variable: result in /in/Edcsv on line 31 res =
Process exited with code 255.