V
V
Vlad2016-05-19 18:01:41
PHP
Vlad, 2016-05-19 18:01:41

How does array_unique() work?

I can not understand where the values ​​from the array disappear!
Here is a list of numbers in the array: pastebin.ru/6o8jRISd
Total 21210
I copy the list to Excel, click "Delete Duplicates" - it writes 12348 left. I
run this array through
array_unique($list)
Also writes 12348 left, BUT I many of the cells of this array become EMPTY!
And in Excel, there really are 12348 values.
Why does array_unique remove duplicates but also make some cells empty??????? joxi.ru/zAN0KlwulL94xm

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2016-05-19
@Sc0undRel

And you will run not through for ($i=0; $<...; $i++), but through foreach ($a as $v).
Duplicates are removed, the association with the index number remains.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question