diff options
author | WWDillingham WesleyDillingham <wwdillingham@sugarlabs.org> | 2009-06-30 18:01:22 (GMT) |
---|---|---|
committer | WWDillingham WesleyDillingham <wwdillingham@sugarlabs.org> | 2009-06-30 18:01:22 (GMT) |
commit | db0545fab3c8d040c9764032b4c26bcc04cb2cd9 (patch) | |
tree | fbc34299c870d6b2ddbaebd7db0af14129ec0635 | |
parent | 9da97956ce8675fccc55b3fb0a48f878946d6747 (diff) |
Created only_addition[] which keeps track of equations with only one operation in them
-rw-r--r-- | order_of_operations_parser.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/order_of_operations_parser.php b/order_of_operations_parser.php index 3b29771..d025d8f 100644 --- a/order_of_operations_parser.php +++ b/order_of_operations_parser.php @@ -83,7 +83,14 @@ for (i=0;i<=$numRecords;i++) //Now we need to determine if a particular question contained ONLY a particular operation - if (preg_match($regexp, $equation + + //Matches operations with ONLY ADDITION + if (preg_match($regexp, $equation) && !preg_match("-", $equation), && !preg_match("/", $equation), && !preg_match("*", $equation)) + { + only_addition[tok[2]]++ + } + + /*# Matches operations with ONLY ADDITION if ( !match($3, /\//) && !match($3, /[0-9]\-[0-9]/) && match($3, /\+/) && !match($3, /\*/) ) |