Have you ever felt like wirintg a function in PHP that the language already has internally? Sure you have! We all have, we are PHP developers. It’s called re-inventing the wheel and all of us do it at one point or another in our career.
Over on his blog “Zend Framework Blog“, Richard Knop has bee doing just this by writing routines to sort arrays. Actually, this is a great idea because he is showing how to implement several CS standard sort routines in PHP. Here are the routines he’s written so far.
I do not get the impression that Richard actually expects people to use these routines. The focus of the articles seems to be just showing how they can be implemented in PHP. Obviously, any code running in userland is going to be orders of magnatude slower than native code. That having been said, understanding these routines has helped countless CS majors over the years.
Whether you want to re-live your CS glory days or just learn from someone else learning, these short and code filled posts are worth taking a look at.