Jump to content

array_unique


dreamwest

Recommended Posts

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
)

 

Link to comment
https://forums.phpfreaks.com/topic/242937-array_unique/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.