Matty Matty - 5 days ago 5
PHP Question

PHP: Testing whether three variables are equal

I've never come across this before, but how would you test whether three variables are the same? The following, obviously doesn't work but I can't think of an elegant (and correct) way to write the following:

if ($select_above_average === $select_average === $select_below_average) { }

Answer
if ((a == b) && (b == c)) {
   ... they're all equal ...
}

by the transitive relation

Comments