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

Onigiri – WebStorage library for JavaScript

Some time ago I had to create a system which was able to save data on a client’s browser. Of course, the most simplest solution which came to my mind was cookies. But I needed a solution in which my data will be accessible for application opened in multiple tabs. I needed a better solution. Soon, I found specification of LocalStorage and IndexedDB, which is a part of HTML5 WebStorage specification. This amazing technology enables you to save data directly on the client’s browser and makes them accessible at any time from any place.

Continue readingContinue reading