Guest User

Untitled

a guest
Dec 22nd, 2011
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. $input = array();
  2. $eq = $_POST['eq'];
  3. foreach($_POST as $variable_name=>$value) {
  4.     if ($variable_name != "eq") $input[$variable_name] = $value;
  5. }
  6.  
  7. // E.g. above would provide:
  8. //$input["a"] = 1.2;
  9. //$input["b"] = 2.4;
  10. //$input["c"] = 2.3;
  11. //$eq = "(a*b)-2(a-c)";
  12.  
  13. foreach($input as $var=>$val) {
  14.     $eq = str_replace($var, $val, $eq);
  15. }
  16.  
  17. echo $eq;
Advertisement
Add Comment
Please, Sign In to add comment