Convert Errors to Exceptions in PHP

By Josh Sherman
1 min read
development
php

I was having a conversation with a buddy of mine the other day and we got on the topic of PHP not having a very standardized error system. Now that he’s working with Python the mix of errors and exceptions in PHP is an apparent shortcoming. PHP is funny like […]

Why I always wear a helmet

By Josh Sherman
9 min read
health
fitness
cycling
safety

When I first starting biking as my primary mode of transportation to my office I felt like I was wearing a helmet mainly because I hadn’t rode a bike in something like 15 years. It’s true what they say, you never forget how to ride a bike (barring a debilitating […]

Speed up PHP with APC

By Josh Sherman
1 min read
development
php

The Alternative PHP Cache (APC) is a PECL package that provides an opcode cache for PHP. Rasmus Lerdorf is the lead of the project along with a handful of other developers. What is an opcode cache? Before I can answer that, let’s discuss how PHP works. Because it is an […]

How to Build a Leaderboard with PHP and Redis

By Josh Sherman
6 min read
development
php
redis

One of biggest draws to Redis for me is the fact that it has more data structure types than just key / value. These additional data structures allow you to do some amazing things while still benefitting from being in-memory. One of the most notable ways to leverage Redis would […]

Getting a User's IP Address in PHP

By Josh Sherman
2 min read
development
php

Getting the IP address of a user seems like a pretty trivial task but you can’t always rely on $_SERVER['REMOTE_ADDR']. The super global value is the most reliable source because it is extracted directly from the TCP stack but if you’re behind a load balancer that address would be that […]