Blog
How to generate the Fibonacci sequence with PHP
The Fibonacci sequence is a sequence of numbers that are derived from the previous numbers in the sequence. The sequence starts at zero and each subsequent number is sum of the previous two numbers in the sequence. There are a…
Stop Accommodating Shortcomings
I came to a very liberating conclusion the other day. I need to stop fucking around with MySQL, or any other RDBMS, and fully embrace a NoSQL server as my primary data store. I’ve been a huge fan of Redis…
How to connect to MongoDB using PHP
I've previously discussed installing the MongoDB module but have yet to touch on how to actually do anything past the install. The first thing to do is to connect to the MongoDB server. This can simply be done like this…
Thoughts on API design
I recently had the opportunity to have a discussion about API design and RESTful services with Vasusen Patil. I’ve also been having quite a few conversations of similar nature with Justin Davis over the last few months. These types of…
How to merge two sorted PHP arrays without array_merge() or sort()
I've had this question come up a few times in the past on interviews, how would you merge two sorted arrays and keep their sort order intact? The easy / PHP answer is to simply use array_merge() and then sort()…
No, I will not fix your computer
I abandoned all of my seemingly witty shirts a while ago, but I’m starting to think I need to pick this one up. At the very least, the mug perhaps. It’s not because I don’t want to help people, hell…
Visibility in PHP
Visibility of functions and properties is very important when you are attempting to lock down certain aspects of an object. In PHP there are three levels of visibility, public, private and protected. Let’s take a look at what each one…
The definition of “done”
For me, “done” means that something I have been working on is to the point that I no longer have to work on it, indefinitely. Depending on the nature of the task it could also mean that it’s been shipped…
Simple PHP i18n internationalization and localization class
As sites and system grow and scale, the need for internationalization and localization (i18n and L10n respectively) of content becomes a necessary task. There's not much to it on the surface, you need to be able to serve up the…
Stop making it so hard for us to share your content
Hey you! Yes, you. You with that blog over there. The one without any sharing widgets whatsoever. Do you really think your content is so fucking special that people are going to go out of their way to copy and…