>array( >'a' => 'one', >'b' => 'one', >'c' => 'zero', >'d' => 'two' >); > >through this and am having a hind time with then logic... Could you >explain how the output would be array('c' => 'zero', 'd' => 'two')??
I was being pretty sloppy with the code (should've posted pseudocode to begin with, my bad) but the general logic is: cycle through each element of the input array. If the value has not been encountered before, store the value and key in a secondary array. If the value has been encountered before (it's present in the secondary array), remove it from the input array, and use the the stored key/value in the secondary array to unset its first instance in the input array, too. --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php