PHP: Testing whether three variables are equal

前端 未结 5 2091
情歌与酒
情歌与酒 2021-02-06 21:43

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 co

5条回答
  •  悲&欢浪女
    2021-02-06 22:02

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

    by the transitive relation

提交回复
热议问题