How to convert an array to a string with PHP

By Josh Sherman
1 min read
development
php

Converting an array to a string is a pretty frequent task when programming. Whether you want to join some sentences into a paragraph or just smash the values into some sort of hash, you can do so very simply with PHP’s implode function. Implode takes 1 to 2 arguments. In […]

Depth vs. duration of friendships

By Josh Sherman
2 min read
friendships
retrospection

This was supposed to be one of those grossly introspective posts that was originally drafted while at that “perfect” level of inebriation (somewhere on the down slope of Ballmer Peak if I had to guess ;) Well, simply put, fuck that noise, let’s talk about friendships! This post had actually […]

sudo without password

By Josh Sherman
3 min read
linux
security

I’ve recently run into deployment scenarios where I need to have a unprivileged user account execute something privileged like restarting nginx. Sure, I could just do things with the root account, but most of my deployments are done via SSH commands and I don’t allow root logins directly on my […]

Days until Christmas in PHP

By Josh Sherman
1 min read
development
php

The holidays are upon us so it’s time for my obligatory holidays themed post! Keep in mind that the title may say Christmas but you could apply this same logic to any holiday or date of your choosing. $christmas = date('Y-12-25'); $today = date('Y-m-d'); echo (strtotime($christmas) - strtotime($today)) / 86400; […]

How to reverse a string with PHP

By Josh Sherman
1 min read
development
php

Reversing a string in most languages is a pretty trivial task. In PHP we have a dedicated strrev function to do so: $string = 'This is my awesome string!'; $reverse = strrev($string); But what if this function didn’t exist? How would you go about reversing the string? For me, I’d […]