X
X

What are Generators?

Generator functions are a new way of programming. They allow us to control the execution of a function and even change the state of the function in mid execution. I’ll compare the generator function with a simple analogy; the traffic…

PHP Namespace’s & group use declarations

When it comes to large scale applications we need to make sure we don’t have conflicting class, function and constant name’s, otherwise we could end up stepping on our own toes. The danger is if we overwrite our classes in…

Expectations

In life we have expectation’s which are backed up by assumption’s. If you assume a company to have a good service based on reputation then you have an expectation on the level of service based on that assumption. However assumptions…

Unserialize filtering

In PHP we can transfer objects from one program to another by transforming them into plain text. Note when doing object serializing AKA turning an object into a string, the method’s are removed as methods can be very dangerous when…

Functional call context

The this keyword is very important because it’s based on context. Context is imperative for communicating with others. We’ve all heard ‘look at this’, instantly like a knee jerk reaction we want to find the focus of the conversation. That’s…

Unicode codepoint escape syntax

PHP7 now lets you use UTF-8 character escaping in the hexadecimal format. We have the Unicode format because our web page’s are served all over the world and need to be displayed consistently which is what unicode allows us to…

Anonymous classes

Being able to create objects is very useful, especially when we need to create lots of them. If we had a program that had to deal with lots of cars then we need lots of car objects which are similar…

Constant arrays using define

Variables are containers that can have differing values, hence their variableness with what they can store. However constants are extactly what they say on the tin, they can contain a value however once the value is assigned it cannot be…

Spaceship operator

The spaceship operator is new to PHP7 and works in multiple ways, meaning this operator does not just return true or false like a regular comparison operator it can return multiple values based on the comparison test. This operator looks…

Null coalescing operator

When considering some of our variable’s must be populated in order for our function’s to work, we need to analyse what our function has been given. When we consider a function can receive a value of null this may put…