How to generate a date range with PHP

By Josh Sherman
1 min read
development
php

From time to time I need to loop through a date range. One approach is to generate a start date and an end date and then add 1 day to the start date until it reaches the end date (or whatever interval you want to increment by). This works wonders […]

How to convert a string to an array with PHP

By Josh Sherman
1 min read
development
php

Converting a string to an array is a pretty common task when programming in PHP. If you don’t know much about PHP you could easily fall into a situation where you’re manually looping through each character in a string checking for a delimiter or keeping a counter and assembling strings […]

Get out of your own way

By Josh Sherman
2 min read
career
retrospection

It happens to the best of us, you’re faced with a seemingly simple problem and you can’t figure it out to save your life. On the surface it’s easy but you start to get wrapped up in hypothetical situations and premature optimization to the point that you’re completely incapacitated. It […]

The cost of convenience

By Josh Sherman
2 min read
development
javascript

Convenience is rarely economical. Shredded cheese tends to be more expensive than a block of the same type. Pre-chopped vegetables are the same way. But when you spend that little extra, you gain that back in time that you don’t have to spend doing the prep work. Technology doesn’t always […]

Sort an array in reverse order with PHP

By Josh Sherman
1 min read
development
php

Arrays are a great way to store / work with data. In PHP, arrays are one of the most powerful data types of available. From time to time, you need to sort an array in reverse order. Of course, PHP has you covered: $array = [ 1 => 'one', 2 […]