I’m late to the PHP5 party. When it was released I kicked the tyres, wrote a few sample scripts, but lacked the time and resources to deploy it properly.
But as I’m about to start a large new project, it’s time to bite the bullet!
I’m playing around with Xapian, which is a C++ search library with a nice object oriented interface, but the PHP bindings for it exposed it as a series of functions, so I set about writing a wrapper to mimic the “real” API.
I noticed several classes implemented an iterator, so I thought it would be an opportunity to try and use the Iterator interface, and found a great article on PHP5 Iterators over at Scatterism.
Within a few minutes, I was able to turn a slightly ugly Xapian loop into a nice foreach – behold!
I knocked up a plugin which maintained a list of “interesting” picture ids, and if it has been displaying one for more than 24hrs, requests the metadata for the next image in the queue, pulls in the image and resizes it suit this layout, and generates a cached HTML fragment for display
I could do with adding some extra metadata to the result, as well making new REST style APIs for user profiles, grid squares etc. We already have an API for bulk data retrieval which needs a key, but these simpler APIs might enable more little gizmos like this one to be produced.