dreamwest Posted July 27, 2011 Share Posted July 27, 2011 Im trying to make this array unique but its making both keys and values unique is there a way around this? $arr = array ( [funny] => 1 [space] => 1 [chimp] => 1 [funny] => 0 [lobster] => 0 ); $track = array_unique($arr); print_r($track); Basically i need the output to be: Array ( [funny] => 1 [space] => 1 [chimp] => 1 [lobster] => 0 ) Quote Link to comment Share on other sites More sharing options...
WebStyles Posted July 27, 2011 Share Posted July 27, 2011 the key 'funny' exists twice, once with value 0, and once with value 1. You cannot have the same key with 2 different values. One will overwrite the other one. 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.