PHP多字符串比较

时间:2014-05-22 07:32:37

标签: php string compare

我想检查6个字符串是否不相同。 我试过这个:

if($first != $second != $third != $four != $fifth != $sixth){}

但是我收到了错误:

Parse error: syntax error, unexpected '!=' (T_IS_NOT_EQUAL)

我不知道能做同样事情的任何职能。

1 个答案:

答案 0 :(得分:6)

if (count(array_unique(array($first, $second, $third, $fourth, $fifth, $sixth)) == 6) {
    echo 'All different';
}
相关问题