Athari / YaLinqo

Yet Another LINQ to Objects for PHP [Simplified BSD]
https://athari.github.io/YaLinqo
BSD 2-Clause "Simplified" License
441 stars 39 forks source link

Distinct filtering support #4

Closed robinvdvleuten closed 11 years ago

robinvdvleuten commented 11 years ago

I have a nested array of strings:

array (size=9)
  0 => 
    array (size=5)
      0 => string 'configuration' (length=13)
      1 => string 'environment' (length=11)
      2 => string 'pagodabox' (length=9)
      3 => string 'php' (length=3)
      4 => string 'wordpress' (length=9)
  1 => 
    array (size=7)
      0 => string 'ckeditor' (length=8)
      1 => string 'configuration' (length=13)
      2 => string 'css' (length=3)
      3 => string 'drupal' (length=6)
      4 => string 'module' (length=6)
      5 => string 'php' (length=3)
      6 => string 'wysiwyg' (length=7)
  2 => 
    array (size=5)
      0 => string 'css' (length=3)
      1 => string 'drupal' (length=6)
      2 => string 'php' (length=3)
      3 => string 'stylesheets' (length=11)
      4 => string 'theming' (length=7)

This is generated by using select, so I've tried selectMany and get the following:

array (size=51)
  0 => string 'configuration' (length=13)
  1 => string 'environment' (length=11)
  2 => string 'pagodabox' (length=9)
  3 => string 'php' (length=3)
  4 => string 'wordpress' (length=9)
  5 => string 'ckeditor' (length=8)
  6 => string 'configuration' (length=13)
  7 => string 'css' (length=3)
  8 => string 'drupal' (length=6)
  9 => string 'module' (length=6)
  10 => string 'php' (length=3)
  11 => string 'wysiwyg' (length=7)
  12 => string 'css' (length=3)
  13 => string 'drupal' (length=6)
  14 => string 'php' (length=3)
  15 => string 'stylesheets' (length=11)
  16 => string 'theming' (length=7)
  17 => string 'environment' (length=11)
  18 => string 'mac' (length=3)
  19 => string 'mamp' (length=4)
  20 => string 'mamp pro' (length=8)
  21 => string 'mysql' (length=5)
  22 => string 'php' (length=3)
  23 => string 'phpmyadmin' (length=10)
  24 => string 'upgrade' (length=7)
  25 => string 'alphabet' (length=8)
  26 => string 'characters' (length=10)
  27 => string 'php' (length=3)
  28 => string 'range' (length=5)
  29 => string 'snippet' (length=7)
  30 => string 'extension' (length=9)
  31 => string 'mac' (length=3)
  32 => string 'mamp' (length=4)
  33 => string 'mamp pro' (length=8)

How can I get all distinct or unique values after selectMany?

robinvdvleuten commented 11 years ago

Thanks for the quick implementation! :+1: