A simple function to get the HTTP status code the given URL is returning.
In PHP 5.4, a new interface called
SessionHandlerInterface was added. it’s purpose was to make creating new session save handlers easier.
I am not going to go into a ton of details here (you can read more on php.net). However, I have written a Redis session handler, which shows a simple use case for this “new” interface.
Using our new class is really simple:
The other day I saw a tweet in my timeline, and it got me thinking. That tweet went something like this:
I’m too busy building cool shit with [insert library here], I don’t want to know how it works.
This is bullshit. As a developer, you need to always be learning. If you aren’t, there are thousands of others who are, and they will gladly replace you.
There have been many times where learning how the internals of a library work have helped me. Whether it was by teaching me a new technique, or by figuring out why a certain edge case returned unexpected results.
If you don’t know how something works, figure it out. Read documentation, ask questions, analyze code. You never know, you may just learn something.
There is No Magic
Do not accept “it’s magic” as an explanation. It is a bullshit answer people use when they don’t understand how it actually works, or are too lazy to explain it. I have done this, and so have a vast majority of developers, and it needs to stop.
Some (dickhead) developers will even tell you things are magic so that they are the only one who knows how it works. They want to feel superior to you. Just ignore them and move along. They aren’t worth your time.
Open source isn’t just about sharing code. It is about sharing knowledge. Take advantage of that knowledge, and learn from others mistakes and triumphs. Together, we can accomplish more than we ever can alone.