Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $input = array();
- $eq = $_POST['eq'];
- foreach($_POST as $variable_name=>$value) {
- if ($variable_name != "eq") $input[$variable_name] = $value;
- }
- // E.g. above would provide:
- //$input["a"] = 1.2;
- //$input["b"] = 2.4;
- //$input["c"] = 2.3;
- //$eq = "(a*b)-2(a-c)";
- foreach($input as $var=>$val) {
- $eq = str_replace($var, $val, $eq);
- }
- echo $eq;
Advertisement
Add Comment
Please, Sign In to add comment