3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function calc_string($string) { $calc = create_function("", "return (" . preg_replace('[^0-9\+-\*\/\(\) ]', '', trim($string)) . ");" ); return $calc(); } echo calc_string("6 * ((26 / (2-2)) + -3) - 20");
based on mluF9
Output for 7.2.0
Deprecated: Function create_function() is deprecated in /in/p6Onv on line 4 Warning: Division by zero in /in/p6Onv(4) : runtime-created function on line 1 INF
Output for 7.0.0 - 7.1.10
Warning: Division by zero in /in/p6Onv(4) : runtime-created function on line 1 INF
Output for 4.3.0 - 5.6.28
Warning: Division by zero in /in/p6Onv(4) : runtime-created function on line 1 -38