Menu
Coddy logo textTech

Empty Variables

Part of the Fundamentals section of Coddy's PHP journey — lesson 11 of 71.

In PHP, the null value is a special value that represents "nothing" or "no value". It's like an empty box - it exists, but there's nothing inside it. For example:

$userPreference = null;

In a real scenario you could use null to indicate that something was not initialized yet.

For example:

$score = null // Score hasn't been calculated yet
$name = null  // Name hasn't been entered yet

Cheat sheet

The null value represents "nothing" or "no value" - useful for indicating uninitialized or missing data:

$userPreference = null;
$score = null; // Score hasn't been calculated yet
$name = null;  // Name hasn't been entered yet

Try it yourself

This lesson doesn't include a code challenge.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals