Codility - Lesson 2: solution to PermCheck in PHP (Test score: 100%)