3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calc_string($string) { $calc = create_function("", "return (" . preg_replace('[^0-9\+-\*\/\(\) ]', '', trim($string)) . ");" ); return $calc(); } echo calc_string("6 * ((26 / 2) + -3) - 20");

preferences:
62.73 ms | 402 KiB | 5 Q