DELAPARRA
Index
Color
NL
Category: Core glossary

Null

Explained by Updated

What is Null?

Null: A value (or the absence of a value) representing "nothing here". Accessing a property of null when you expect an object is one of the most common runtime errors. Null represents the absence of a value: no middle name, no delivery date yet, no customer linked. Many languages have it, under names like null, nil or None.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Null

How is Null used in practice?

It is also one of the most common sources of runtime errors. Code expects an object, receives null, and crashes when it calls a method on it. Its inventor, Tony Hoare, called it his "billion-dollar mistake".

What should you keep in mind with Null?

Modern tools help. PHP has nullable types like ?string, the null-safe operator ?-> and the null coalescing operator ??. Static analysis with PHPStan warns when a value might be null. Decide deliberately where null is allowed, in your database columns as well as in your code. A clear rule, such as required fields being NOT NULL, removes many checks and many bugs.

At a glance

CategoryCore glossary
Explained by
Updated

More Core glossary terms

All terms starting with N

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.