按值的跨度以正确的顺序删除数组项

I know these questions have been covered everywhere, but I have the following solution and want to make sure it will always work.

Consider the following array...

Array
(
    [299] => <span class="state-2"><span class="typetitle">Unit 1</span><img src="/unit1.jpg" /></span>
    [293] => <span class="state-2"><span class="typetitle">Unit 2</span><img src="/unit2.png" /></span>
    [231] => <span class="state-2"><span class="typetitle">Unit 3</span><img src="/unit3.png" /></span>
    [336] => <span class="state-2"><span class="typetitle">Unit 3</span><img src="/unit3.png" /></span>
    [188] => <span class="state-2"><span class="typetitle">Unit 4</span><img src="/unit4.png" /></span>
    [334] => <span class="state-2"><span class="typetitle">Unit 5</span><img src="/unit5.jpg" /></span>
    [294] => <span class="state-3"><span class="typetitle booked">Unit 2</span><img src="/unit2.png" /></span>
    [335] => <span class="state-3"><span class="typetitle booked">Unit 4</span><img src="/unit4.png" /></span>
)

Items that have a class of state-2 are available, and ones with state-3 are fully booked, and are ordered last by design because i sort the array based on value title. That bit works.

Now I want to remove the duplicate units (unit 2, unit 3, unit 4) in this same order, so that the first occurrence remains, and the last occurrence does not. That way, if a unit is booked, but one of the same type is still available, the available one isnt hidden, which is what happens when i do this...

$services = array_intersect_key($services, array_unique(array_map('strip_tags', $services)));

My question is, how does this remove the duplicate item? Does it find the first one, keep it, and then remove any further duplicates?

Can i guarantee that this array_unique will work this way every time? Or is there any risk of it removing the first in the array?

Ah, i found that array_unique accepts a sort var if I want to include it, but that in php 5.2.10 it was changed to SORT_STRING by default.

This should always ensure that as long as my initial array sort is always correct, array_unique will keep the first found instance, and remove each sequential duplicate.

Source: http://php.net/manual/en/function.array-unique.php