2014-05-22 200 views
-2

我想檢查6個字符串是否不相同。 我已經試過這樣:PHP多字符串比較

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

但我得到的錯誤:

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

我不知道誰可以做同樣的任何功能。

回答

6
if (count(array_unique(array($first, $second, $third, $fourth, $fifth, $sixth)) == 6) { 
    echo 'All different'; 
} 
+0

這就是純粹的美麗 –

+0

+1閱讀我的想法。 –

+0

+1。毆打一拳。 –