I have the following array:
$myarray = Array("2011-06-21", "2011-06-22", "2011-06-22", "2011-06-23", "2011-06-23", "2011-06-24", "2011-06-24", "2011-06-25", "2011-06-25", "2011-06-26");
var_dump($myarray);
Result:
Array (
[0] => 2011-06-21
[1] => 2011-06-22
[2] => 2011-06-22
[3] => 2011-06-23
[4] => 2011-06-23
[5] => 2011-06-24
[6] => 2011-06-24
[7] => 2011-06-25
[8] => 2011-06-25
[9] => 2011-06-26
)
- Now how can I display the keys with duplicate values? Here the function should NOT return ([0],[9]) since there are no duplicates with the values.
- How to find the keys for the same value, eg. for "2011-06-25" it should return [7],[8]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…