PHP function to evaluate comparisons between two values, with debug logging
Clash Royale CLAN TAG #URR8PPP .everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0; up vote 3 down vote favorite The following method works fine but it is rather verbose: private function performComparison($element, $operator, $value_allowed, $value_entered) switch($operator): case '>': $result = ($value_entered > $value_allowed) ? true : false; break; case '>=': $result = ($value_entered >= $value_allowed) ? true : false; break; case '<': $result = ($value_entered < $value_allowed) ? true : false; break; case '<=': $result = ($value_entered <= $value_allowed) ? true : false; break; case '=': $result = ($value_entered == $value_allowed) ? true : false; break; endswitch; $dateformat = 'n/j/Y'; $debug = ['element' => $element, 'operator' => $operator, 'value allowed' => is_a($value_allowed, 'DateTime') ? $...