Jahren Posted December 3, 2008 Share Posted December 3, 2008 Hi guys quick question : is there a way to test an array has ALL different values inside like $a = array('1', '2', '3') = true $a = array('1', '1', '3') = false ? Quote Link to comment Share on other sites More sharing options...
corbin Posted December 3, 2008 Share Posted December 3, 2008 http://php.net/array_unique Example use: if(count($a) == count(array_unique($a)) { //unique values! } There might be a better way, as two count is kind of... bleh. Quote Link to comment Share on other sites More sharing options...
Jahren Posted December 3, 2008 Author Share Posted December 3, 2008 hey that's ingenious thanks buddy ^^ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.