Shuffling arrays in PHP

Recently, while working on a portfolio searching system I faced one problem with displaying results. It turned out that portfolios of same users appear close to one another. This was not good as I wanted to show variety of different users portfolios on a search result page. Therefore I needed to shuffle them somehow. Generally, in PHP there are three ways to shuffle arrays:

  • Random array shuffle
  • Non random index shuffle – array indices are always re-organized in the same way
  • Non random value shuffle – shuffle result depending on array values

Continue readingContinue reading