cakephp - PHP unique array function for nested array -


is there way use array_unique function working nested array below? want rid of date duplicates , 2 dates out array...

array (     [0] => array         (             [value] => 1311044688             [name] => 19th jul 2011         )      [1] => array         (             [value] => 1311044919             [name] => 19th jul 2011         )      [2] => array         (             [value] => 1311045076             [name] => 19th jul 2011         )      [3] => array         (             [value] => 1311164873             [name] => 20th jul 2011         )      [4] => array         (             [value] => 1311165000             [name] => 20th jul 2011         )  ) 

i'd write array array using date keys, , "values" value. that's fastest way achieve you're looking for.

something like:

$uniqueary = array() foreach ($ary $item) {   $uniqueary[$item['name']] = $item['value']; } 

you'd want include bit of logic determine value takes precedence in case of dupes.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -