This is the website of Andy Carter a PHP and jQuery web developer in the Steel City. Working with CakePHP (and a bit of Textpattern and Drupal too).

Latest Entries

PHP 7.3 was released at the end of last year, but for many of us working with the latest version of PHP is not an option for a while. We are often restricted by the servers that we have to deploy to which can often be a version or two behind.

This means that for many, the new features of PHP 7.3 will remain out of reach for some time. If this describes your situation then this post is for you. We’ll look at four things you can start doing now that will help make it easier to migrate your code to PHP 7.3 when the time finally does arrive.

With the arrival of PHP 7.3 last month came some interesting changes to the existing heredoc and nowdoc syntaxes. However, not everyone I spoke to even new that this syntax existed in PHP, so now seems like a good opportunity to take a look at what they are and how to use them.

Have you thought about casing?

#

This is an interesting look at how we use casing in our code. In his blog post Brendt argues that snake case is more readable than camel case. I particularly like this point that he makes:-

Readable code, reduces cognitive load. Less cognitive load means more memory space for humans to think about other things, things like writing business logic.

I’ve always preferred camel case over snake case, but I think that has been for purely aesthetic reasons over how easy they are to read.

A simple little trick in PHP for when you need to make sure that a value doesn’t drop below zero. For example, you might be subtracting a discount from a basket total and not want the amount to be paid to become negative.

Earlier today I got caught out by an interesting little issue when using env() to access environment configurable values on a deployed Laravel app. Despite having read through the documentation I managed to completely miss the caveat on using this function whilst caching the app’s configuration.

Featured Entries

Essential Visual Studio Code Extensions for PHP Developers

Visual Studio Code is hot stuff right now and is quickly becoming the editor of choice for developers worldwide. It’s available for Macs, Windows and Linux and best of all it’s free. These are what I consider the essential Visual Studio Code extensions for PHP developers to improve your productivity.

Latest Tweets

Follow Me