3v4l.org

run code in 300+ PHP versions simultaneously
<?php $r['crime']= (string)print("hello world"); $input = "\$sucrate=" . str_ireplace(array("LEVEL", "EXP", "WILL", "IQ"), array(1,2,3,4), $r['crime']) . ";"; $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;
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.21, 8.3.0 - 8.3.9
hello world expr = 1 res = 1

preferences:
130.06 ms | 404 KiB | 296 Q