I am generating an array of numbers based on an equation then rounding to the nearest 100.
After that I want to get rid of duplicates, array_unique seemed like the natural choice for this situation, but is not working as intended.
I created a small sample to demonstrate this. The PHP code is as follows:
var_dump($amounts);
array_unique($amounts);
var_dump($amounts);
The result of which is:
array(6) {
[0]=>
float(200)
[1]=>
float(300)
[2]=>
float(300)
[3]=>
float(400)
[4]=>
float(500)
[5]=>
float(500)
}
array(6) {
[0]=>
float(200)
[1]=>
float(300)
[2]=>
float(300)
[3]=>
float(400)
[4]=>
float(500)
[5]=>
float(500)
}
Can someone shed some light on what is happening here please?