PHP Keywords: declare and enddeclare

Welcome to my series on every PHP keyword and its usage. Today’s items: declare and enddeclare. This keyword is used to declare certain properties for a specific block of code. The block can be delimited by curly braces {} or the enddeclare keyword. It can also be declared standalone, and will apply to all following code in the file, as well as any included files. There are currently three different properties that can be declared using the declare construct:

Overlapping Elements with CSS Grid

One of the challenges that a web developer sometimes faces is to make two elements overlap. This is easy enough to achieve using position: absolute, but one often runs into the problem: What if you’re not sure which element will be taller? Say you have the following CSS: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 .

On Debugging

When it comes right down to it, debugging your own code can feel a bit like a murder mystery, perhaps best put into words by a dramatic, anime heroine: Screenshots are from the anime “絶園のテンペスト (Blast of Tempest)”, available on AnimeLab.

JavaScript Promises

Promises are probably my favourite thing in modern JavaScript. They’re relatively simple, but they simplify the architecture of a JavaScript app immensely. Not only do they protect us from passing callbacks up and down our chain of functions (a.k.a. callback hell), they simplify the entire function. Synchronous code is usually easier to reason about than asynchronous code, and promises are the first step towards asynchronous code in a synchronous style.

PHP Keywords: const

Welcome to my series on every PHP keyword and its usage. Today’s item: const. This keyword allows you to define a constant (an immutable value, can only be defined once) globally or for a specific class. Values that can be placed into an expression are limited to: Any scalar literal, e.g. true, 7, "green". Any existing constant. An array literal containing any of the above, e.g. [1, 2, 3].