note 47278 rejected from function.array-count-values by cece

From: Date: Wed, 10 Nov 2004 00:06:25 +0000
Subject: note 47278 rejected from function.array-count-values by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-80325@lists.php.net to get a copy of this message
Note Submitter: spam at nerstu dot com ---- I've got a problem with array_count_values. I first got this array: Array ( [0] => [1] => 10 [2] => 10 [3] => 10 [4] => 9 [5] => 10 [6] => 10 [7] => 1 ) Then use array_count_values to make this: Array ( [] => 1 [10] => 5 [9] => 1 [1] => 1 ) So far so good, but when I try to output nothing happends. I write like this: echo $array[10]; I've tried array_values but then my reference of which value is counted is lost. An output after array_values looks like this: Array ( [0] => 1 [1] => 5 [2] => 1 [3] => 1 ) When using array_valus the output works fine but I need to know which value that got for example 5 entries? If run true var_dump the original array_count_values array looks like this: array(4) { [""]=> int(1) ["10"]=> int(5) ["9"]=> int(1) ["1"]=> int(1) } compared to the array runned through array_values aswell: array(4) { [0]=> int(1) [1]=> int(5) [2]=> int(1) [3]=> int(1) } Not a huge difference but in the first there is " " around the keys. Don't know if it makes any difference?

« previous php.notes (#80325) next »