Categories

Tags

Page 16 of All Articles

Decouple your code from your web server

I used to be quite adamant about running nearly the same exact software stack locally as I did on my servers. Running Linux made it easy to pull this off and being able to do the same on OS X was a contingency for switching. I have never been a […]

Start your day with a list

I’ve been seeing these “how productive people start their day” posts on my social feeds a lot more recently. It got me thinking, “hey, I consider myself successful, how do I start my day?” A while back I started to make mental notes about how I started my day, or […]

Calculate the length of a string with PHP

Calculating the length of a string is a useful feature of any language, in fact it’s one of the few pieces of functionality that has a consistently simple syntax across modern languages. You can calculate the length of a string as part of some server side user input validation or […]

Non-binary genders are complicated

No, this post is not some rant about non-binary genders. I’m actually referring to the trials and tribulations that I went through to implement a third gender option on my social network. The title is an homage to the CSS-Tricks post titled Features Are Complicated. This isn’t some dramatization, it’s […]

How to get a server's hostname in PHP

The hostname of your server or local system is an easy way to determine which environment you are working with, either local or production. Prior to PHP 5.3 you would need to utilize the php_uname() function and with 5.3+ there is a built-in function for getting the hostname: pre-5.3 $hostname […]

Never stop learning

As cliché as this post’s title is, I tend to forget this simple truth from time to time. This week was one of those weeks where I learned a ton of shit. Worked with some new to me libraries. Learned a new term that I’m on the verge of over […]

How to save a remote file to disk with PHP

You may already be familiar with file_get_contents() for reading the contents of a local file but did you know that you can use it to read the contents of a remote file or site? You can then use file_put_contents() to write the file’s contents back to disk: file_put_contents('./some/local/file', file_get_contents('http://phpave.com')); Both […]

Refocusing my blog’s content

For my first post as a 34-year-old, I wanted to announce that I am refocusing my blog’s content. It’s a pivot of sorts as I have been pining over what I should focus my content on. I have noticed over the last few years of blogging that my PHP blog […]

Basic HTTP Authentication with PHP

Basic HTTP Authentication is easily accomplished at the web server level (by way of .htaccess with Apache or inside your nginx configuration file) but did you know you could pull it off inside of a PHP script? You bet your butt you can! First, you will need to interrogate the […]

Making time for side projects

I’m absolutely sick and tired of hearing people complain about not having any time for their side projects. Even worse is when I get asked the seemingly presumptive “how do you find for side projects when you have a family?” Rarely does that question get asked without a tone that […]

Life of Pi - Working with Pi in PHP

The irrational mathematical constant of Pi can be obtained a few different ways in PHP. There is a function to give you the value as well as a bunch of constants that represent Pi as well as fractions of Pi and it’s square root. Heck, you could even do it […]

How to replace a string with a string in PHP

String replacements in PHP are very simple and as per usual, can be done in a variety of different ways. First let’s take a look at the most simple form of a string replacement: str_replace('blue', 'red', 'My favorite color is blue'); The first argument is the string you want to […]

Developer titles are bullshit, Part 2 - Universal titles

Last week in part one, I discussed the lifecycle of a developer that just started a new job. The gist was that when someone starts a new role at a company, they generally have to learn the lay of the land. Regardless of their technical prowess there is always a […]

How to round numbers with PHP

Rounding numbers can be done a number of ways. You can round a float up or down to the nearest integer or you could round to a specific precision. Even then you can choose whether or not to round halves up or down and even round towards even and odd […]

Developer titles are bullshit, Part 1 - The lifecycle of a developer

This is a pretty universal truth, most developer titles are complete and utter nonsense. Shit like “Junior Developer” and “Senior Engineer Level 2”, sounds like we’re playing Dungeons and Dragons. Sad part of this is, most people will say they don’t care about titles but then they are quick to […]

Ikea Expedit standing desk

I wholeheartedly decided that I would convert my existing Ikea Expedit sitting desk and bookshelf combo to a “hipster developer” standing desk. Part of the decision was because of my buddy Mike. He was telling me about how using a standing desk had dramatically improved his posture and in the […]

Converting decimal to other number systems with PHP

It felt a bit like cheating to split this post up so I figured I would just cover all of the decimal to… functions in one post. Decimal, also known as base ten, is the numerical base we are most accustomed to. From time to time we need to convert […]

To infinity and beyond! Working with infinity in PHP

We can file this one under the “PHP functions I never knew existed and probably will never use” category. Seems that as of PHP 4.2.0 and beyond there was the inclusion of an is_finite() and an is_infinite() function. The names are pretty self explanatory and I’m sure there are some […]

5 things I learned by unliking all of my Facebook likes

In an effort to limit my digital footprint, one of the things I am doing is not liking every fucking thing on Facebook. In addition to not liking anything moving forward, I also went back and unliked everything that I have liked over the last 3 years or so. This […]

High Volume Showdown: Linode vs. DigitalOcean

I’ve done quite a few of these comparison posts and I have always stuck with the inexpensive plans. I figured, what the hell, let’s see how Linode and DigitalOcean stack up when running larger, comparably priced plans! The price point for this comparison is 640$ per month or around 96¢ […]

Finding the smallest or largest value with PHP

Figured I would keep up the trend of talking about finding the smallest and largest values in arrays by talking about finding the smallest or largest value in a set of values. Incidentally, doing so will utilize the same min() and max() functions we used previously. Not one of my […]

Life without Google

I’ve decided that this year is going to be the year that I try to limit the amount of information I put out onto the Interwebs and hone my social presences and take back my privacy as best as I can. I’m “liking” less, I’m not going to reveal my […]

Find the largest value in an array with PHP

Last week we discussed how to find the smallest value in an array so it seemed fitting to discuss how to find the largest value in an array. As we previously discussed back in the day you would have to loop through an array and compare values until you found […]

How I doubled my investment with GAW Miners Hashlets

I can already hear the sneers of skepticism from my readers as I write this post. I know at least one person will fail to read the entire article and post some shitty comment about how GAW Miners are running a crypto-Ponzi scheme. I actually agree with them 100% but […]

Find the lowest value in an array with PHP

Finding the lowest value of an array is a pretty common task in PHP, especially when you are dealing with things like scores or money. In the old days before PHP 4, finding the lowest value of an array meant looping through the array and comparing values until you had […]