DevPath

De-duplicate values preserving order

Foundation · fluency · 15 min · runtime php-cli

Brief

Implement uniqueValues(array $items): array that returns the values of $items with duplicates removed, preserving the order of first appearance. Do not sort the result.

3 progressive hints are available in the editor.

Public checks

  • removes duplicates — expected: [1,2,3]
  • preserves order — expected: [3,1,2]