diff options
-rw-r--r-- | order_of_operations_parser.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/order_of_operations_parser.php b/order_of_operations_parser.php index a984111..156496c 100644 --- a/order_of_operations_parser.php +++ b/order_of_operations_parser.php @@ -87,7 +87,7 @@ for (i=0;i<=$numRecords;i++) //Now we need to determine if a particular question contained ONLY a particular operation //Matches operations with ONLY ADDITION - if (preg_match($regexp, $equation) && !preg_match("-", $equation), && !preg_match("/", $equation), && !preg_match("*", $equation)) + if (preg_match($regexp, $equation) && !preg_match("-", $equation), && !preg_match("\/", $equation), && !preg_match("*", $equation)) { $only_addition[tok[2]]++ @@ -115,7 +115,7 @@ for (i=0;i<=$numRecords;i++) } //Matches equations with ONLY SUBTRACTION - if (preg_match($regexp, $equation) && !preg_match("+", $equation) && !preg_match("/", $equation) && !preg_match("*", $equation)) + if (preg_match($regexp, $equation) && !preg_match("+", $equation) && !preg_match("\/", $equation) && !preg_match("*", $equation)) { $only_subtraction[tok[2]]++ @@ -127,7 +127,7 @@ for (i=0;i<=$numRecords;i++) //******************************DIVISION******************************** //contains division - $regexp = "/" + $regexp = "\/" if (preg_match($regexp, $equation)) { $contains_division[tok[0]]++ @@ -164,7 +164,7 @@ for (i=0;i<=$numRecords;i++) } //Matches equations with ONLY Multiplication - if (preg_match($regexp, $equation) && !preg_match("+", $equation) && !preg_match("/", $equation) && !preg_match("-", $equation)) + if (preg_match($regexp, $equation) && !preg_match("+", $equation) && !preg_match("\/", $equation) && !preg_match("-", $equation)) { $only_multiplication[tok[2]]++; @@ -179,7 +179,7 @@ for (i=0;i<=$numRecords;i++) //**********************************************COMPOUND EQUATIONS********************************* // can simply not use regexp but replace with a literal reg expression - if(preg_match("+", $equation) && (preg_match("-", $equation) || preg_match("/", $equation) || preg_match("*", $equation))) + if(preg_match("+", $equation) && (preg_match("-", $equation) || preg_match("\/", $equation) || preg_match("*", $equation))) { $compound[tok[0]]++; //NOTE compound_incorrect is implicit |